The iPhone handset is locked into the SIM so that if you place another SIM card into the iPhone, it would have to be reactivated to work. You can place the iPhone SIM card into another non-Apple mobile phone, and it will work, but only on the same carrier. So it would seem that the handset is locked to the SIM card, but the SIM card is locked to the carrier.
In short, you cannot use an AT&T iPhone handset with an 02 iPhone SIM card, and simply pay local 02 call charges. You are locked into AT&T, regardless of whether you're in the US or abroad. If you travel regularly, it might be cheaper simply to have 2 iPhones, but as far as the UK is concerned (and the US also?), you'd be paying monthly charges - the minimum in the UK is £35/month for 600 mins of calls, 500 texts, and unlimited data.