The weapon is attacking the target you designate. If that target goes invisible, the spiritual weapon will still attack the last known position of the target designated, with the same miss chance as any other targeted attack.
I would rule myself as a GM that if they went invisible but stayed in the same place the SW would keep attacking with the same 50% miss chance for attacking an invisible target, but if they moved it would be unable to follow because it uses your knowledge of the target to keep locked on. You designate the target, but if you can't find the target, it can't either. As a courtesy I would then have it return to the caster rather than keep attacking the same place assuming the invisible target had stayed in the same place.
I would be interested in what the official ruling would be on this, but that is how I interpret it.
Also, when you GM and your players argue with you on something like that, just say "I am ruling it works this way for now, until I find or am presented with evidence otherwise. Get to researching when we are done!" lol