quote; Does code allow water tanks allowed to be installed in bathrooms? If so an exposed T&P tube could harm someone if it went off.

Not gas water heaters unless they are "sealed combustion units". The same applies to bedrooms. The discharge MUST be installed so it CANNOT harm ANYONE or ANYTHING if it goes off.