Can I play an event knowing it does nothing, just to get it out of my hand? For instance, could I play a Compelled by the Queen which reads " Any phase: Choose and stand or kneel an attachment. Then, stand all Targaryen characters with Banner attachments attached" if there aren't any attachments in play nor are there any Targaryen characters with Banner attachments attached?
Discarding
No you can't play that event. If you don't have a valid target for an event, you can't attempt to play it.
Just to clarify, you could only play it if there was an attachment in play as that is the target of the event. If you had no Targ characters with Banner attachments it wouldn't restrict you from playing it, because it isn't the target of the event, it's just an effect that resolves on the back of the initial effect of the event being played.
The general rule of thumb is that it must be legal for you to initiate any effect. In order to initiate the effect, you have to be able to pay the cost, choose all targets, and meet all play restrictions. So if you are told to pay 2 gold (cost), choose an attachment (target), or only play if you are the First Player (play restriction), you have to be able to do those things in order to activate/play the effect.
However, while you must be able to legally play it, there doesn't have to be any practical effect as a result. You can legally trigger an effect knowing that nothing will come of it.
So, for example, if you have the event card "Westeros Bleeds" (Dominance: Kneel 4 influence to discard all characters from play) and just want it out of your hand, you can't just "play" because you need to kneel the 4 influence to pay for it. But you can kneel the 4 influence and play it if there are no characters in play to discard.