Magnesium has initially been held back by technical difficulties in the removal of chloride inclusions. These had been solved only after a lot of progress had been made in aluminum alloys. Also, magnesium parts should only be used in a dry environment - when the metal is exposed to water, rapid corrosion must be expected.
The first application of magnesium in aerostructures was in the 1930s (mostly under the trade name Elektron), with a small boom in the 1950s. Lockheed even built one F-80C fully from magnesium. Magnesium was widely used in the former Soviet Union, but eventually phased out in newer designs due to corrosion problems. Flammability, by the way, was never a real concern with magnesium.
With improved protection techniques, magnesium might make a limited come-back. It is already used in castings and extruded parts. Per kilogram, it is twice as expensive than aluminum, but very easy to machine. However, at higher temperature it will lose strength even faster than aluminum.
Parallel to that, aluminum sheet can be made lighter and stiffer by adding up to 2.5% of lithium. These Al-Li alloys have found their way into the newest aircraft designs and will raise the bar for magnesium applications.
Magnesium and water really don't mix well: Trying to extinguish a magnesium fire with water is a memorable experience, as adding water will intensify the reaction. Use iron chips or sand instead to cool down the burning metal and to keep oxygen away. Historically, though, magnesium fires on aircraft have been extremely rare.