Blood flowing to your legs has the benefit of the heart pumping it there. Once blood is there, it needs the action of leg muscles to help pump it back to the heart.
Locking your knees makes standing upright and still easier, but decreases the use of your leg muscles in standing.
This causes the blood to pool in your legs, effectively taking it out of circulation.
Less blood in circulation means less oxygen getting to the brain.
When the brain senses a dangerous drop in oxygen, you pass out.
An intuitive way of conceptualizing it: blood flow isn't fighting gravity when everything is on the same level. By passing out, your brain gets itself, the legs, and the heart all on the same plane so no more relying on leg muscles to overcome gravity.
It's not the locking of the knees that cause someone to pass out. It's the pooling of the blood in the legs that can accompany the long periods of standing without engaging the muscles that gets you.
There are no blood vessels being pinched off when you lock your knees.