|This article is about an older version of DF.|
Miasma is a "noxious odor" or otherwise-poisoned air, once believed to spread disease. The theory of miasma as the general cause of disease propagation was quite widespread prior to the 19th century, and although in some respects it is correct that some diseases may be transmitted via the air, not all diseases are transmitted by such mediums.
In Dwarf Fortress, the only impact a miasma will have is to disgust dwarves encountering it, giving them bad thoughts. However, one miasma can disgust a large number of dwarves, especially if it is in a main corridor.
The most common cause of in-game miasma are rotting corpses or body parts left on a tile that is Subterranean. Often the corpses of small vermin killed by cats will cause a miasma. You can limit your dwarves' exposure to miasma by setting up a refuse pile (outdoors, or in an enclosed space -- see refuse). Rotting items left outside will not generate miasma.
Miasma will not travel through walls, ceilings or closed doors, but will travel through fortifications (as they have holes in them). Miasma will also spread across Z-levels through stairs or ramps.
It also does not "spread" diagonally, which allows for some nifty constructions that entirely block spreading of miasma from a refuse stockpile (basically have walls on all non-diagonal tiles that neighbour refuse).
Because Miasma is only generated by corpses on tiles that are subterranean, which ironically lets it spread in magma, and because once a tile has been exposed to the outside, it is never again subterranean, it is fairly simple to set up Miasma-free fortresses. One need only expose those tiles which are likely to generate miasma (for example, Kitchens and Butcher Shops) by digging a hole in the ceiling over the whole thing, and then patching it up again. If you are doing this quite far underground, a simple solution to all of your miasma problems caused by rotting food or remains in shops is to make shops diagonal to the hallway leading to them. You will still generate Miasma, but at the very least it will not enter your hallways.