How are problems in astronomical spectroscopy solved? Astronomers based on the ground telescopes, watch the stars and make predictions about them based on the spectrum of light. But when the light from those stars reach the telescopes through the atmosphere, some of it will be absorbed by atmosphere.
How is this problem solved to get true data about stars?
 A: The atmosphere obscures data in three main ways; it absorbs light, it emits light in the infrared, and finally it diffracts light leading to distorted images. Observers have ways to deal with all three things, but I'll focus on the first two since they are more directly related to your question:
1) Atmospheric absorption. 
This plot gives a rough idea of what the atmospheric transmission is as a function of wavelength of light:

The main thing to notice is that there are regions in wavelength where most of the light gets through, and other wavelengths where none of the light gets through because of absorption by molecules in the atmosphere. (It's not a coincidence that visible light travels very well through the atmosphere). Astronomers avoid studying wavelength regions of heavy atmospheric absorption from the ground. So although it's a bit unfortunate, there are wavelength bands where we really cannot collect useful information from the ground. 
Now even within these good bands, as you can see in the first figure, the atmospheric transmission is not perfect, and in fact it varies from night to night, and depends on how much of the atmosphere you're looking through to observe the target (if it's low on the horizon you're looking through significantly more atmosphere than if it's right overhead). In order to accurately correct for these effects, astronomers will typically take spectra of very bright, very hot stars, relatively near in the sky to the thing that they're trying to study. These very hot stars are known to have blackbody spectra with few intrinsic features, so it is possible to measure the relative absorption as a function of wavelength by seeing how much the spectrum of the star deviates from a blackbody.  
2) Atmospheric emission:
The molecules in the atmosphere are constantly absorbing and emitting light, especially in the infrared. Below I've copied a link which has a spectrum of the blank sky in the infrared, at one of the best observing sites on Earth:

Sky emission is a serious issue in the infrared. It is even more of a problem than sky absorption, as it can vary significantly on short (minute) timescales. Fortunately here too astronomers have a solution, which is to periodically take blank sky spectra throughout the night while they observe their main science target. This enables them to monitor the intensity of the sky emission, and subtract it from their science data.
Summary: To deal with atmospheric absorption, astronomers take spectra of targets with simple known spectra, such as very hot stars. To deal with emission, observers must take blank sky spectra and subtract these from their science data.
