As a rule, nothing can “burn” without Oxygen. However, different things may happen to depend on if there is free Oxygen (O2) present. Most things require free O2 in the air or fed from a tank to burn. But Magnesium has the unique ability to react with things around it such as CO2 (Carbon Dioxide) or H2O (water) to extract Oxygen for burning.
So, while Magnesium can burn in an environment devoid of free O2, it cannot burn in an environment completely devoid of the Oxygen element.