Gas masks usually operate on the simple chemical principle of having activated carbon remove potentially lethal materials from air. Even low concentrations of dangerous materials are removed by these masks. Look up gas masks at the How Stuff Works site (http://www.howstuffworks.com/).
In situations where very high concentrations of lethal gases may be encountered, safety devices include carrying personal air supplies. In modern firefighting, fire fighters usually carry individual air supplies.
Interest is this area has increased greatly since the 9/11/01 attacks in NYC.