I am referring to this scene (starting at the 0m37s mark) in Star Wars, Episode V: The Empire Strikes Back.
This seems like a very sophisticated prop glove, but there is significant visible depth to the "cavity".
How was this filmed?
You can see the original prop here. Note that the metal collar has slipped down slightly.
The actor would sit under the table and reach up through a hole, then place their hand flat onto the table. The prop would then be slid into position flush against their hand, covering the hole and creating the illusion that it was their real arm.
If you look closely at the slope of the back of Mark Hamill's hand, you can see that it seems to turn a bit more toward the vertical as it approaches the metal clamp on his wrist. In fact, Hamill is reaching up through the table, with the heel of his hand pressed against the end of a a fake arm. Everything to the right of the metal clamp ring is a fake limb; the robotics are embedded in a completely fake lower arm segment. Notice how the texture of the actor's real skin on the hand and the fake skin above the clamp are quite different (although, in universe, that could be attributed to Luke's traumatic injury).
Note that Hamill's upper body is never in the shot while the arm panel is open. After the droid 2-1B closes the panel, it immediately cuts to Hamill sitting down, with his arm free of the restraints. It is a really well done shot, and I remember when I first saw the movie as a young child, the coolness of seeing Luke's new hand almost helped me overcome my horror that they had not managed to rescue Han Solo at the end of the film.