For a single fish, 2.5 gallons is fine as long as the tank is maintained and the occupant is cared for, IMHO.
I see this firsthand with my betta. Long story short, I've kept fish for 40 years in tanks from 10 to 30 gallons, but I haven't had a tank in the last 7 years. This Christmas my wife bought me a 0.4L desktop nano tank from Sharper image - no filter, no heater - really just a desktop stress-reliever. I had no intention of putting a fish in it becuase it was so tiny, but my wife bought me a Betta two weeks later (she meant well,LOL). I work from home, and my desk is tiny - 20"wx40"l. The nano tank fit on my desk.
I had my betta, Fredo, in the Sharper image tank for two weeks, doing daily water changes. Needless to say, he was not happy - he wasn't eating, hung out at the bottom, and hasd no room to swim.
I went out and got the Fluval Betta Premium tank, which has 2.6 gallons for the fish (and another gallon for the filter and heater, for a total of 3.6G). It is the biggest tank I could realistically fit on my desk, so I did the best I could.
I am doing fish-in cycling using Fluval Cycle, and monitoring the water daily. Tank is planted with live plants, and Fredo is a different fish. He is active, eats with gusto, and his colors and fins are beautiful!
To me, while the 0.4L was definitely too small, the larger (but still small) tank has given Fredo a great place to live and be happy. I also think that while I don't have space for a 5+ gallon tank, providing a well-kept 2.6 gallon is fine, and much better than him still sitting at Petco in a cup with the other bettas.