|MadSci Network: Earth Sciences|
There are some air molecules in the thermosphere, the mesosphere, and the exosphere. The density decreases as distance from the earth gets larger, but each of these layers do have some air molecules. The density is just much much less than that in the troposphere and the stratosphere. Remember that temperature is defined as a measure of kinetic energy of molecules compared to a relative scale, such as that on a mercury thermometer. More sophisticated instruments are required to measure energy as molecular density decreases but instruments exists for measuring a number of different quantities at higher elevations - such as percentage of ozone in the stratosphere - and so the instruments just have to be more precise and refined than the instruments we use at the surface of the earth. Another way to get at this measurement is to use a calculation. Remember the "universal " gas laws: P time V = R times T even with a very small P (pressure) we can calculate T (temperature) for a given volume as long as we can measure P - using various forms of barometers. The question of using the quantity of temperature at high altitudes might be a different one - why would we need to know, and, what would we use it for? However, scientists want to know even if we're not sure how we will use the information. A textbook for more details (probably at the graduate level) is Introduction to Atmospheric Physics 2nd edition by Fleagle and Businger (academic press publishers).
Try the links in the MadSci Library for more information on Earth Sciences.