TL;DR: Don't set the layer opacity to 0... Just makes sure that 1) the ayer has an alpha channel (the default) and 2) the layer is filled with transparency
There are two "opacities" at play here, a "pixel opacity" within the layer where some pixels are opaque and others are not, and a "layer opacity" that applies to the whole layer (the final opacity of a pixel is the pixel's own opacity multiplied by the layer opacity). The opacity you are setting to 0 is the layer one, so everything is made transparent.
There are two "opacities" at play here, a "pixel opacity" within the layer where some pixels are opaque and others are not, and a "layer opacity" that applies to the whole layer (the final opacity of a pixel is the pixel's own opacity multiplied by the layer opacity). The opacity you are setting to 0 is the layer one, so everything is made transparent.