An undefended piece is not currently attacked by anything. A hanging piece, on the other hand, is an undefended piece that is attacked and can be captured.
It’s important to understand that even if an undefended piece is not in immediate
danger, it is still a vulnerable target because a threat against it will usually require an urgent response... more on tactical targets
Diagram - Black has moved ... Ng4 threatening White's queen but must remember that it's an undefended piece and not leave it hanging. Play