Magnesium is very reactive metal like (Na, Ca, etc.). When it expose to air it reacts with oxygen to form a layer magnesium oxide (MgO) on its surface.
`2Mg+O_{2} \Rightarrow 2MgO`
This layer of magnesium oxide is quite stable and prevents further reaction of magnesium with oxygen. The magnesium ribbon is cleaned by sand paper to remove this layer so that the underlying metal can be used for the reaction.
Concept: Always remember that magnesium being a reactive metal will react with oxygen if kept in open. So, it has to be cleaned before it is burned in air.