In the UK, you are handed a ballot paper in the voting room by an official immediately before you go to the polling booth; the ballot paper has an official mark on it, meaning no pre-printed or duplicate ballot papers are possible.
This makes the attack you described impossible (short of having every official in the voting room being corrupt).