howd u get it was it from a contract? if not o2 prob use same method as vodafone so only legit way will be to contact them who will most likely charge you £20 they then send off to apple to unlock the phone which takes 2 working days then ull get a e-mail to confirm its done bang in a new sim card and sync with itunes and job done.
however due to the mass amouts of iphones that are getting stolen o2 may ask u take take ur proof of purchase and id into a store to prove were u got it from and if u cant do that u wont get ur money back or ur phone unlocked