Was it installed on another computer somewhere? If so, at your own risk, you can take the keygen from the registry editor of that PC:
Ahem, at your own risk:
On the computer you have it installed on.
1 Click on Start > Run
2 Type "regedit" (without the quotes)
3 In Registry Editor look in:
HKEY_LOCAL_MACHINE
SOFTWARE
Electronic Arts
The Sims 2
ergc
4 The install code will be listed in the Data column.
Just be extremely careful when you are in regedit.
Do not change anything or you can cause major problems.