If this is the case and you've entered your pin code incorrectly less than three times then you simply have to type in your PUK code when it requests it on the screen. If it hasn't come up automatically on the screen then you need to turn your iPhone 4 off and then back on again. Once it is turned on, the PUK code should be requested; type the code in and you should gain access to your phone again.
However, if you have incorrectly put in your pin code three times or more than this will unfortunately lock the sim card permanently. This means you won't be able to access any data on the sim card. If a different sim card is inserted in your iPhone 4 then it will work fine.
Therefore if you think your sim card may have been permanently blocked, then you must contact your service provider and tell them. Their usual procedure is to issue you with a new sim card. You should still be able to keep your number but if your contacts, pictures and messages were only saved to your sim card then unfortunately they may be lost forever.
Once you receive your new sim card simply swap it over with the locked on and your phone should again be in fully working order.