Press on the brake and see if you can move the gear shift lever from park to neutral and back. You may have a bad shift interlock solenoid at the gearshift or some problem in the activation of that solenoid--the solenoid is usually activated by a shift position switch, also at the gear lever.
Sometimes these solenoids get all gunked up with dirt, etc., as do the switches in the gear shift, so maybe if you can get into the gearshift lever, you can clean up the solenoid contacts and get lucky here.
The idea is that the key can't be removed until the car is in park. But if the solenoid doesn't know you're in park it won't release the key.