Prince Harry has lost his legal challenge over the level of security he receives when he is in the UK.