I have an HP and take off my key tops all the time. I have a Shift key that is sticky, and I have to remove the lint that accumulates around the little rubber thingie, and sometimes wiggle the rubber. It gets dislodged & the key doesn't push down well.
The keyboard does NOT have to be replaced as a whole.
You can see here that you can buy the individual keys:
http://shop.ebay.com/items/?_nkw=HP+Pavilion++Replacement+Keyboard+KEY
Here is a pic of how your key components probably look. Your hinge (on the right) will probably be white or black.
There IS a trick to taking the key top off & putting the key top back on.
Try it FIRST with a key you don't really use, like the top row, f4 key or something. This way, if you can't get it back on, it's not a vital key.
To take OFF the key, place your fingernail underneath the key from the bottom. Gently & slowly, lift up & back at the same time. NOTICE how the hinge goes up too, as you lift the key out of the locking tabs, so you can put it back on in the same way.
Once you get the key top off, take a little Q-tip or brush to swab off the lint that has accumulated around the rubber thingie.

Carefully, move the rubber around a little to loosen up the rubber, but be careful not to dislodge it, or you will have to glue it back down. Dust under the hinge too.
To put the key top back on:
You have to hold up the hinges with your fingernail of one hand, at the bottom. Slide the key top (from the top,) downwards to slide the tabs into the top hinge. Let go. Then then push the whole key down until you hear it lock down in place. (You might have to wiggle a little to align the tabs so they lock down.)