Constraint forces determine the movement of components in a system, constraining the object within a boundary (in the case of a slope plus gravity, the object is stuck to the slope, when attached to a taut string it cannot move in an outwards direction to make the string any 'tauter'). Constraint forces ensure the velocity in the direction of the constraint is zero, which means the constraint forces do not perform work on the system.
If the system doesn't change in time, they eliminate all movement in the direction of the constraint, thus constraint forces do not perform work on the system, as the velocity of that object is constrained to be 0 parallel to this force, due to this force. This only applies for a single particle system. For example, in an Atwood machine, the rope does work on each body, but keeping always the net virtual work null. There are, however, cases where this is not true.
For example, the centripetal force exerted inwards by a string on a ball in uniform circular motion sideways constrains the ball to circular motion restricting its movement away from the center of the circle. This force does zero work because it is perpendicular to the velocity of the ball.