Counter target spell. Draw a card, then discard a card.
If the target spell is an illegal target when Refute tries to resolve, it won't resolve and none of its effects will happen. You won't draw or discard.