The House has rejected a bill that would have banned transgender athletes from competing in girls' and women's sports.