First thing I'd do is reset the PRAM. Unlikely to really solve the problem, but takes like 5 seconds to try.
And the good news is that if an external keyboard works properly, it's not likely a logic board issue, so it will be economical to repair as opposed to it being better to just get a new system.
Now, there is one thing you could try, but it depends on A) whether or not you have AppleCare on this still, and B) how comfortable you are with the prospect of removing the bottom cover and tinkering with things. If it's out of warranty, you can remove the bottom cover, disconnect the battery, then reseat the keyboard flex cable. It's a flat cable, maybe about an inch wide, and you should see it around the middle of the case kind of wedged between the logic board and the battery.
There's a little locking lever for the connector at the top, and you just use your fingernail to carefully lift that up. If you break it, you'll need a new logic board, so CAREFULLY. Then using some non-conductive tool, work the cable out of the port, then put it back in. When it's all the way in, you should only be able to see a small part of the gray colored bit, the rest should look black. Where the two different colors meet is what you should see just barely sticking out of the connector. Put the locking lever back down, connect the battery, and test out the keyboard.
If that doesn't resolve the issue, the entire top case has to be replaced. The keyboard is not a separate part. It's actually not that expensive. I'd say probably less than $200 for the part, maybe another $100 for labor (it's a PITA to replace a top case on a unibody... You have to take the entire system apart and rebuild it on the new top case).
Now if it's still under AppleCare, do NOT try anything on your own, take immediately to the nearest Apple store or AASP, do not pass go, do not collect $200... Make it Apple's problem to fix. Same deal if you have some kind of store warranty with a place like Best Buy or Fry's. You touch it, and they catch you out on it, then you just voided your contract.