One of the rules for targeting spells in the Player's Handbook says that spells must have a clear path to the target:
A Clear Path to the Target
To target something, you must have a clear path to it, so it can't be behind total cover. If you place an area of effect at a point that you can't see and an obstruction, such as a wall, is between you and that point, the point of origin comes into being on the near side of that obstruction.
And the description for total cover says:
A target with total cover can't be targeted directly by an attack or a spell, although some spells can reach such a target by including it in an area of effect. A target has total cover if it is completely concealed by an obstacle.
However, the spell sacred flame says that the target "gains no benefit from cover". Does this mean sacred flame can target someone that is behind total cover?
Best Answer
Yes, as long as they can see the target (according to Rules as Intended)
Jeremy Crawford confirms that this is indeed the intended interpretation of the spell's effects on the Jan. 19, 2017 episode of Dragon Talk ("Wolfgang Baur on DMing for Girl Scouts"). Starting at 36:20, he says (transcription done by me):
So, mechanically, this means that, as long as the caster can see the target, they can target them regardless of how much cover they have. Since total cover is a type of cover, it also is ignored by sacred flame.
For comparison, the normal rules for targeting dictate that if a spellcaster is behind a sheet of glass with no possible line of effect to the target, they cannot target them with a spell.
Narrative explanation
Jeremy Crawford continued on from the above provides some reasoning behind the spell and why it was written as it is. While not vital for a mechanical understanding of the spell (the above logic should be more than sufficient), it is interesting nonetheless.