I found a workaround for myself. I used a joint, which had both degrees of freedom, with both of them being controlled by an input. Through a simple logical decider one of them is set to zero and the other is set to the control input.
This of course only works for joint, that are controlled by input, not passive joints, that are controlled by external forces.
Maybe this also helps others.