A 26-year-old male presents with persistent low back pain for over 1 year, accompanied by limited mobility and morning stiffness, which improves with activity. He also reports knee joint pain for the past 6 months. Physical examination reveals restricted forward flexion, extension, and lateral bending of the spine. Laboratory tests show negative rheumatoid factor (RF). The most likely diagnosis is: