Hi, I work at T-Mobile.
What I can tell you that the PUK codes are written on the SIM cards when you purchase one at T-Mobile.
If you activate a SIM card, then activate a 2nd SIM card for that same NUMBER: SIM card 1 gets permanently deactivated. If your SIM is deactivated, then there literally is nothing you can do with that SIM, you'll have to purchase a new one.
So if you are using a T-Mobile SIM, and its asking for the PUK code, you'll need to have either the SIM card tray it came on when purchased (either SIM only or device that included a SIM in box) or try having the account accessed that the voice line is on, where the SIM is active.
The customer service folks, now called Team of Experts, will ask you to verify the account, then you can request that they look up the PUK code.
A representative in either a corporate or third party retailer can also look up this info for you.
In order to use the Device Unlock app, the app would need to have been pre-installed on your phone already. So try to flash a T-Mobile variant ROM to see if you can obtain access to the app.
In order to use the app, you'll need that device IMEI activated onto a valid working SIM on an account that is current, active and in good standing for around 4 to 6 months for PostPaid accounts, and over 12 months on prepaid accounts to utilize the Permanent Unlock option.
I forget the rules to the temporary unlock button option.
No version of the Device Unlock app online actually works, I'm guessing they use some sort of network certificate in an above standard method to tie the app to specific reasons in order for it to function properly.
Following all/any of these tips should gain you an unlocked device.
Good luck!