T-Mobile devices require usage on the network before an unlock is allowed. Sometimes they will allow an unlock without use on the network, but since you did not buy the phone from them that most likely will not happen.
What is the error message you are receiving? If it is the device is not...