Can he continue to control the Spiritual Weapon on his subsequent turns and remain Hidden? Or does attacking the enemy with the Spiritual Weapon remove him from being Hidden?
RAW Revealed, but that doesn't make a lot of sense.
This should work! Spiritual weapon only requires that
As a bonus action on your turn, you can move the weapon up to 20 feet and repeat the attack against a creature within 5 feet of it.
Hiding rules suggest that the way to become visible is:
you give away your position if you make noise, such as shouting a warning or knocking over a vase.
There is no verbal command or anything that suggests that moving/directing to attack does anything physical that would result in losing your Hidden state.
A DM could decide that such a command does make you visible
Hiding in 5e is very much dependent upon DM rulings, with the Basic Rules even stating:
The DM decides when circumstances are appropriate for hiding.
However, given my statement above, it seems that the Bonus Action control for Spiritual Weapon shouldn't do anything that would prevent you from maintaining your Hidden status.
Who is actually attacking?
As SDJZ says in their answer, the RAW does state that the caster is actually the attacker, and that would make one visible.
However, a DM ruling that while the caster is 'attacking' it is the Spiritual Weapon that is interacting at the hidden bequest of the caster and thus remain hidden.
But RAW is definitely losing Hidden status and then DM would then have to rule whether or not you could Hide again after revealing your position.
By strict RAW, the attacked enemy would know the rogue's position
When a character uses spiritual weapon to attack it is actually the caster that is making a melee attack:
you can make a melee spell attack against a creature within 5 feet of the weapon
On subsequent turns you repeat the same attack:
you can move the weapon up to 20 feet and repeat the attack
A melee spell attack counts as an attack so the caster is indeed making an attack.
The rules for Unseen Attackers (SRD p. 94) state that (emphasis mine)
When a creature can’t see you, you have advantage on attack rolls against it. If you are hidden—both unseen and unheard—when you make an attack, you give away your location when the attack hits or misses.
This means that, as strange as it might sound, making an attack with Spiritual Weapon would indeed give away the Rogue's position.
Of course, since the spiritual weapon only requires a bonus action the Rogue can continue to hide using an action each turn after attacking.
Using the action economy, the rogue would need to hide each turn
To make this work, since both the cunning action 'hide' and the spell damage consume a bonus action, and you only get one bonus action per turn, the rogue needs to use his/her action to hide. But that also means that, as Sdjz points out, when the attack is made the location of the attacker will usually become evident. (See below for more on that).
Round 1: Cast spell using bonus action, hit/miss, hide. (Rogue now hidden)
Round 2: attack using bonus action, hit/miss, hide. (Rogue now hidden)
Rounds 3-10: rinse and repeat.
But are you 'hidden' for purposes of getting advantage on the attack per the rules on unseen attackers, PHB p. 94? The attack itself reveals the PC who then needs to hide again.
But what if I am behind total cover?
The question that this situation has raised to me is: does the "that you can see" criteria apply to this spell? It's not in the spell text.
Basic Rules, page 102.
When you cast the spell, you can make a melee spell attack against a creature within 5 feet of the weapon. On a hit, the target takes force damage equal to 1d8 + your spellcasting ability modifier. As a bonus action on your turn, you can move the weapon up to 20 feet and repeat the attack against a creature within 5 feet of it.
The rogue might be able to remain hidden by using total cover, and never be seen. Given the lack of "that you can see" in the spell text, the rogue could conceivably make the attack from total cover since that text's absence (so common in other spells) implies that the rogue need not see the target.
- That makes no sense to me (as either player or DM) since how does the PC know where the target is to attack, or if the target is in range (60' away or less)? Use of some spells or magic items might allow for this -- spells such as wizard eye when your warlock class goes up higher -- since spiritual weapon does not use concentration.