If you've lost the CD-key for a game, all may not be lost — the manufacturer can often help you recover it.
Reach out to the company that made or published the game, such as Sony, and explain that you've misplaced your key. These support teams are generally quite helpful and may be able to assist you in retrieving your key code. It's worth having your proof of purchase handy to speed up the process.