The quaternion part [q_x, q_y, q_z, q_w]
has four numbers but is a representation of 3D orientation, which has 3 degrees of freedom. Another common representation for orientation is the matrix Lie group $\mathrm{SO}(3)$, which is the group of $3\times 3$ rotation matrices (9 numbers, but only 3 degrees of freedom). Neither the quaternion nor the rotation matrix are minimal representations (i.e., they take more numbers than the degrees of freedom), but they do not suffer the issues associated with, e.g., Euler angles (gimbal lock, ambiguity, etc.).
So, there are only 6 uncertainty values in pose_covariance_diagonal
because there are only 6 degrees of freedom in a 3D pose (i.e., the matrix Lie group $\mathrm{SE}(3)$). These are uncertainties for each translation axis, and each rotation axis. See the PoseWithCovariance msg docs for more info.