Ga K-edge x-ray absorption measurements were employed to investigate Mg-doping effects in GaN samples. Strong polarization-dependent x-ray absorption near-edge structures become less pronounced with increasing doping concentration, indicating the formation of a mixing-phase structure of cubic and hexagonal phases. Analysis of the extended x-ray absorption region of the spectra revealed doping-related defects such as vacancies, substitutions, and interstitial occupations. They were formed anisotropically in the crystal c axis direction and its perpendiculars. Disorderliness arising from phase mix and defects is believed to have lowered the Debye temperature of the doped GaN films and caused the destructive interference of the absorption fine-structure oscillation functions. These effects were taken into account for the observed large coordination number reductions in our samples.