Elimination of the internal electrostatic field in two-dimensional GaN-based semiconductors