Niue's political situation is quite interesting, but not without precedent (see the Cook Islands, for example). It is a self-governing state in free association with New Zealand, an arrangement set up back in 1974. Although it has full constitutional independence and manages its own domestic affairs, it maintains close ties with New Zealand, which provides assistance with foreign affairs and defence, but only when Niue asks for it. More importantly, all Niueans are automatically New Zealand citizens. While this free association exists, Niue operates like an independent country internationally, even establishing diplomatic relations with various sovereign nations like the United States (being the latest in a growing list).
However, despite functioning independently, Niue is definitely not a full member of the United Nations. Nevertheless, the UN organizations treat Niue's status as equivalent to independence under international law, and it is a full member of several key UN specialized agencies, such as UNESCO and the World Health Organization. The reason Niue hasn't pursued full UN membership is largely practical since achieving full status might risk the crucial automatic right for all Niueans to hold New Zealand citizenship, which grants them essential freedom of movement.
https://en.wikipedia.org/wiki/Niue
https://en.wikipedia.org/wiki/Political_status_of_the_Cook_Islands_and_Niue