Active-Noise Reduction Headsets
The question appears to be directed towards active-noise reduction (ANR) headsets. Such devices reduce sound by sensing the ambient noise penetrating the earmuff cup, inverting its phase, and reintroducing it via a small earphone to cancel the sound that is present. This only works well in the low frequencies, below about 500 Hz. In the popular consumer headsets, such as the Bose QuietComfort 2, the ANR circuitry reduces the outside sounds, while at the same time the "good sound" you refer to comes from a CD or other audio source plugged into an earphone jack. The ANR system is designed to allow this alternative signal, injected into a different part of the circuit, to pass unaffected. Thus, the normal sound blocking capabilities of the earmuff cup are augmented by the ANR in the low frequencies to provide a quiet background in which to hear the desired audio source (music, speech, or sound track).
Hearing aids do provide compensating circuitry to alter characteristics as they operate in different sound environments, but do not currently provide noise cancellation via ANR concepts. This would require additional transducers and power consumption.
By the way, an alternative means to be able to listen to good sound in an adequately quiet background is to use the popular insert earphones available today, such as the Etymotic ER-6. Using eartips that provide a good seal to the ear, they block sound (even better than the lightweight ANR earmuffs) and as with the QuietComfort2, and include the capability to listen to a high-quality sound source. Your choice will be determined primarily by whether you prefer wearing an earplug or an earmuff, as well as by the ergonomics of using a small earphone vs. a somewhat larger earmuff. Cost is also an issue and depending on the earphone or ANR earmuff that is selected, the price can vary from under $100 to a few hundred dollars.