Understanding of bonding is key to modeling materials and predicting properties thereof. A widely adopted indicator of bonds and atomic shells is the electron localization function (ELF). The building blocks of the ELF are also used in the construction of modern density functional approximations. Here, we demonstrate that the ELF breaks down when applied beyond regular nonrelativistic quantum states. We show that for tackling general noncollinear open-shell solutions, it is essential to address both the U(1) gauge invariance, i.e., invariance under a multiplication by a position dependent phase factor, and SU(2) gauge invariance, i.e., invariance under local spin rotations, conjointly. Remarkably, we find that the extended ELF also improves the description of paradigmatic collinear states.