Preheat your oven to 350°F. Grease a 9-inch round or square baking pan and set it aside.
In a large bowl, place the flour, xanthan gum, cocoa powder, salt, baking soda and sugar, and whisk to combine well.
Create a well in the center of the dry ingredients and add the sour cream, oil, eggs, vanilla, and water, and mix to combine well. The batter should be very thickly pourable.
Scrape the batter into the prepared pan, smooth into an even layer and place in the center of the preheated oven.
Bake until a toothpick inserted in the center of the cake comes out mostly clean or with a few moist crumbs attached (about 30 minutes). Do not overbake.
Remove the cake from the oven and allow to cool for 10 minutes in the pan before inverting onto a wire rack to cool completely.
To make the ganache topping.
In a small, heavy-bottom saucepan, heat the heavy whipping cream until it just begins to simmer. Place the chopped chocolate (10 ounces for whipped ganache) in a medium-size bowl. Pour the hot cream over the chocolate.
Allow the cream to sit on the chocolate for about a minute, until the chocolate begins to melt, and mix until the chocolate is melted, and the mixture is smooth and glossy.
Pour the warm ganache over the top of the cooled cake, and gently spread toward the edges so the ganache begins to drip down the sides of the cake. Allow to set at room temperature before serving.
To make whipped ganache
If you forgot to use 10 ounces of chopped chocolate instead of 8 and nothing has cooled yet, just melt 2 more ounces of chocolate and add it to the prepared ganache. Follow the same instructions as above through mixing until smooth. Allow the ganache to cool at room temperature until no longer hot to the touch.
Cover and place the bowl in the refrigerator until the mixture is firm enough to scoop with a spoon. Transfer it to a large bowl.
Beat with a handheld mixer or stand mixer fitted with the whisk attachment until thickened and fluffy (about 5 minutes). It will lighten in color as it reaches the right consistency.
Add the optional confectioners’ sugar and beat until well-combined. Frost as desired.