Just like in Paint, how can I do a "transparent selection"? For example, if red is the background color and I select a part of an image with red in it, I want my selection to consider the the red to be transparent.

Or equivalently : How can I change a specific color inside a selection to transparent?