The answer to both your questions is to:
a. use a story variable to track if the room key has been purchased or not.
b, use a <<if>> related macro combined with the story variable to conditionally display the links.
1. Intitialise your story variable to false within your project's StoryInit special passage.
<<set $hasRoomKey to false>>
2. Within the passage you can purchase the Room Key from use the current state of the story variable to determine what to show. (note: I have named this passage Reception in my example)
You see a receptionist at the counter.
<<if not $hasRoomKey>>
\<<link "Purchase a room key, then visiting the Hallway" "Hallway">>
\<<set $hasRoomKey to true>>
\You have already purchased your room key.
[[Visit the Hallway|Hallway]]
3. Within the passage you can use the Room Key in again use the current state of the story variable to determine what to show. (note: I have named this passage Hallway in my example)
You are at the end of a long hallway, there is a closed door with an electronic here.
\[[Use Room Key|Your Room]]
\You wish you had a room key.
[[Return to Reception|Reception]]
As you can see If you visit the Hallway without purchasing the Room Key to will not see the link, and if you return to Reception after purchasing the Room Key you will not be able to purchase the item again.