There is a magnetic coil inside the area where the key goes in. This magnetic coil "reads" the key code that is embedded in the starter key and compares it with the key code programmed in the ECU. Due to accumulation of dust / grime, sometimes the coil is not able to "read" the code on the key. Usually cleaning the coil does the trick. It may, however, be possible that due to wear-and-tear the coil itself is damaged. In this case the coil will have to be replaced.
I have experienced this problem twice in the last 5 years. The first time it got fixed with simply cleaning the coil. The second time the coil had to be replaced. It is not a long (or expensive) job -- can't remember how much I paid.
Unfortunately, both times the dealer sorted it out for me, so I can't help you with a step-by-step "how to" post. I guess I caught it while it was still intermittent. I can see your problem, though -- you need to get your car to the dealer first!! Just try turning the key repeatedly (from OFF to MAR to ON); hopefully on one of these tries, the code light will go off. That's your window to make a beeline to the nearest dealer!!!!
Good luck ....