If you have not redeemed the psn 12 digit code xxxx-xxxx-xxxx in the psn store it will not work.

There is a redeem codes under the account management menu. You can use that or redeem it in the psn store.

Was the game new and sealed in the case when you purchased it?