I would disagree with everyone else. Say something like this, "I regret to inform you that you were not selected."
In response to any questions about details. "Sorry, it is against policy for me to answer that."
Don't say that someone else got hired. Because someone else might not have been. You might still be looking. And the candidate may see the ad for that position again and get upset.
Volunteer nothing except the barest of bare facts.
Cheers,
Ben