There are several ways you could do that, but the obvious choice for me would be to use a layer mask.
First, make a layer filled with your desired color:
Next, use Layer → Mask → Add Layer Mask.. to add a fully opaque mask for the layer.
Then create the text or other shape you want to cut out from the image, e.g. some text, as black on white:
Finally, copy the text and paste it into the layer mask. Your color layer should now have a transparent text-shaped hole in it:
There are many other possible ways to achieve the same result, e.g. using Color to Alpha or just by selecting the text by color and cutting the resulting selection out of the color layer. The nice thing about layer masks, however, is that the mask and the content of the layer remain separately editable, allowing you to easily adjust them later.