We use hard x-ray photoemission spectroscopy (HAXPES) to investigate the electronic structure of YbAl2, for which the Yb valence has not been consistently reported to date. The bulk sensitivity and the analytical simplicity provided by the Yb 3d core-level HAXPES allow a reliable determination of the mean valence of Yb ions. For YbAl2, it is evaluated to be +2.20, which remains nearly unchanged below 300 K. The Kondo resonance peak with an extremely high Kondo temperature (above 2000 K) is clearly identified in the valence-band spectra. The results indicate that a coherent Kondo state can be robust even in a nearly divalent system.