A transgender taxi driver who was fired after making inappropriate comments to staff and relatives of children at a special needs school has lost a case in which he claimed he was discriminated against on the grounds of his gender.