If you don't pay the contract then they block the phone, in the old days you just put a sim in from another network, nowadays they share the info so within a few days it is blocked on all networks.
Depending on the phone you might be able to text and it will still work on WiFi for internet access, but calls are out.
T-Mobile will show unregistered sim and refuse network connection, Vodafone will show connected but will drop the call if you attempt to dial out.
Bit confused as to why O2 would block a phone that wasn't part of your contract (as it's T-Mobile branded), they tend to only block the phone that the sim was last in if the sim is reported stolen, so it is possible that someone at O2 has used the wrong menu and giving customer service a bell might sort it out.
If you pay the contract they'll unblock it for you, other than that it's either send it abroad (phones are only blocked within the UK at the moment, but this might change soon) or break it up and sell the parts (screen etc), failing that, aim for the bin...