Only way I know to unlock an iPhone is if it's out of contract. Call AT&T and tell them you want your phone unlocked. If they tell you it's not possible, tell the operator it's law and if they don't unlock it you will file a complaint with the FCC.
It's surprisingly easy to file a complaint online to the FCC, and it gets action even more surprisingly.
Once AT&T submits your iPhone for unlocking, it will take about 3-7 days. You need to hook the phone up to iTunes on your Mac/PC and connect to it. You'll be greeted with a message that congratulates you on having an unlocked iPhone now.
I had to drop the FCC complaint thing with AT&T, which got their attention real fast. 2 different operators told me it was not possible. Don't give up, they are legally required by law to unlock your phone if requested (and out of contract).