Heatley signed for 3.5M x 3. Hossa signed for 5M x 3. That doesn't seem like a big difference, but the salary cap was only 39M. It would be like 8.XXM vs 11.XXM now. Additionally, Atlanta took De Vries as a cap dump. It's difficult to find accurate info on historical cap hits now, but if I recall he as somewhere around the mid 2M mark. So along with replacing De Vries with a warm body, they likely cleared almost 10 percent of the cap in that transaction.
There wasn't a realistic way to keep him short of re-tooling, which using hindsight and looking at how he chased cups for a few years after leaving Atlanta probably means he would leave anyways. Or, we would have probably had to trade Alfredsson+De Vries. Which is someone says keeping Hossa is better than keeping Alfredsson, that's fine, but it's not a scenario where there was an easy pain free way to keep Hossa at top money.
It's difficult to armchair GM everything and give a big list of what they possibly could have done because while you can find each individual cap hit by digging through google, there isn't a cap friendly type layout of the team and the entire league.
Here is an article that references their cap situation:
Senators gain cap room, new image in Hossa trade
Had they not made the trade, they would have not had enough room to run a full roster. I am unsure about the structure of Spezza's contract at the time, but I assume his performance bonuses and also being able to add players in season at the trade deadline was going to be a consideration. Lastly, it wasn't just about the 2005-2006 season. They had multiple raises to give out over the following 2 seasons.
Heatley was damaged goods at that point, so for him and Spezza to mesh so well and his career to get back on track for a few years, it worked out about as well as it possibly could have. They got a few good years out of Heatley, and they (unintentionally) dumped him to a different team right before the second contract they gave him became an albatross.
Ultimately, other than my suggestion that we move Alfredsson instead of Hossa, nobody has made a realistic suggestion about how they could have kept Hossa without tearing the team apart and re-tooling. They were in a very difficult cap situation. They were one of the teams who were hurt the most in the short term by the timing of the salary cap.