After looking through the service manual, the problem can be the transmission selector position switch contact for Park, the wire between the transmission selector position switch and the Body Control Module (BCM), and possibly the need for the BCM to be reprogrammed, (if it had been replaced prior). In the extreme, the BCM may need to be replaced as defective, followed by programming. With regard to the switch contact and wire, false voltage or ground along that path would likely confuse the BCM more than a simple open circuit.
Since you mentioned key out of ignition, if you dont hear a distinct click with a relay operation in the column when you remove the key from the ignition, lube it with graphite lock spray, (never WD-40 / it flushes and dries the tumblers unprotected) and cycle the key a few times and see if it functions.
Additional info regarding the ignition switch. If you can remove the key while the switch is in the run position, there is a standing recall for the 2005's to replace the lockset to prevent this from happening. Check with your dealer for this free repair to see if it applies to your VIN. Ours had this happen at 210k miles.
Good luck!