No, if your iphone is locked to AT&T the phone will not recognize any other simcard you put in so 3G or voice or nothing from no other carrier than AT&T.
That's what a carrier locked phone does.
If you do unlock your phone, you can only use edge on t-mobile (and there's no way around that). If you're travelling, it depends on what frequencies the carrier is using.