We introduce a class of exactly solvable
SO(n) symmetric Hamiltonians with matrix product ground states. For an odd $n\ensuremath{\ge}3$ case, the ground state is a translational invariant Haldane gap spin liquid state; while for an even $n\ensuremath{\ge}4$ case, the ground state is a spontaneously dimerized state with twofold degeneracy. In the matrix product ground states for both cases, we identify a hidden antiferromagnetic order, which is characterized by nonlocal string order parameters. The ground-state phase diagram of a generalized
SO(n) symmetric bilinear-biquadratic model is discussed.