Correct. When you insert a non-AT&T SIM, it will either boot up & work on the alternate provider's network, OR it will prompt you for an unlock code. The prompt means it's not unlocked & requires you to enter a code.
Probably the least expensive way of obtaining a T-Mobile SIM (other than finding a friend who already has T-Mobile service & borrowing their SIM), would be to purchase a T-Mobile prepaid phone for $10-15 on sale at Walgreens or similiar retailer. They come with a SIM in the package, and should work for this purpose. I think T-Mobile will charge you ~$35 for a SIM with a new service.