Miasma is a cloud of purple stench that makes your dwarves unhappy. It only occurs in subterranean areas, and is caused by rotting items. It does not pass through doors.
 Rotten Items
A rotten item is a corpse, body part or an item of food that has spoiled, either from not being in a stockpile (if food) or just over time (if a corpse/body part).
Often a job in a kitchen, still or farmer's workshop will be canceled with the announcement "...needs unrotten (item)". That doesn't mean you only have rotten ones, it means there is not an appropriate item that is available. Items that are forbidden, marked for dumping, or that have no path will be disregarded for workshop tasks.
Body parts of living dwarves may also be marked as "rotten" if they are affected by a syndrome which causes necrosis. The afflicted body part produces miasma from time to time.
 Avoiding Miasma
To avoid miasma, either keep anything rotten outside or alternatively have an inside refuse pile on its own in a room with several doors; this should halt the miasma's advance (although the room itself will still stink up). It will also not spread diagonally, so one possible solution is to have the only entrance be diagonal.
Another option is to have a long garbage chute where refuse is dumped down. If it is long enough the miasma will not be able to reach all the way to the top, preventing your dwarves from getting unhappy thoughts.
A creative way of constructing garbage chutes is to separate the garbage area and dumping area (where dwarves are) with hatches linked to a pressure plate. That way garbage will land on the hatch, which will open (triggered by dwarf returning to his duties stepping on a plate), letting it fall down and then close, keeping all the miasma inside. This allows one to construct a short, yet non-smelly chute.
Another option for a short non-smelly chute is to let the chute be seperated diagonally from the dumping square(s). Since miasma does not travel across corners, this allows a chute stretching across 2 z-levels to be completly miasma free, without needing additional mechanisms.
Tip: If you do not feel like messing with Miasma,**if you only have a butcher shop** just remove the shop and replace it
Example #1 WWWWWWW W=Wall WWWWWOW .=Floor ....-WW O=Channel WWWWWWW -=Floor with dumping zone
Example #2 WWWWWWW W=Regular Wall .=Regular floor WWWWMQW M=Wall with dumping zone ....--W Q=Channel with dumping zone WWWWWWW -=Floor with dumping zone
 Related Bugs
Note that dwarves interrupted in the middle of a meal will abandon their food. Food abandoned in this manner can never be interacted with (picked up, stored, or dumped) by any dwarf ever again, including the dwarf who abandoned it. Bug:1299 If the food is abandoned underground, it will eventually rot and generate miasma. This is an especially frequent occurrence with soldiers, who will often be interrupted while consuming their rations when a training class begins. One workaround for soldiers is to use the military supplies tab to prevent them from carrying food.
The utility DFHack includes a command "cleanowned" to clear ownership and dump all owned items that are on the floor or rotting. This can help if you're dealing with miasma from this bug.