Sanction of the victim?

I imagine there must be a substantial literature on whether sometimes, you should boycott a process you feel is illegitimate rather than trying to ameliorate its effects by participating. For instance, should a democratic political party participate in substantially unfree elections, or should one collaborate with an illegitimate regime? I would appreciate pointers to relevant important literature on the subject.