A UK court has determined that a ban on Muslim prayer at a school in London was lawful, in a court challenge against a student.