If the issue is purely software then I think step 10 of the article named One or more keys on the keyboard do not respond found here http://support.apple.com/kb/ts1381
Start from the Mac OS X Install Disc, choose Terminal from the Utilities menu and test the keys which were previously not working. If the keys work while started from the Install disc, then the keyboard itself is working correctly. Use Mac OS X: How to troubleshoot a software issue to isolate the software issue that may be causing the keys to not respond.
Since you have Mountain Lion, rather than a disk you should boot to the recovery partition and test the keys there in the terminal. This is how to boot from the recovery partition:
OS X Lion or OS X Mountain Lion includes a built in set of utilities in the Recovery System. Restart your Mac and hold down the Command key and the R key (Command-R), and keep holding them until the Apple icon appears, indicating that your Mac is starting up. After the Recovery System is finished starting up, you should see a desktop with a OS X menu bar and a "Mac OS X Utilities" application window. Note: If you see a login window or your own desktop and icons, it is possible that you didn't hold Command-R early enough. Restart and try again.
From: OS X: About OS X Recovery