You are correct that Danny is a restricted free agent. We have his "early" Bird rights which means we can match any offer up to the MLE.
If we trade him away, we don't get cap relief as you suggested. That is, if he gets signed for $5mil/year and we trade him to a team under the cap, our cap number doesn't go from $49mil to $44mil.
What happens is that we get a trade exception back so that we could trade for a player whose salary exceeds the salary we send back. So for example, if we get a trade exception for $5mil, and we trade Matt Bonner (What is he at, $4mil?), we can absorb back a contract at $9mil.
But even at that, your scenario is incomplete because it doesn't factor in the cap holds to get us to the minimum roster size.
Bottom line, you have to be WAY under the cap for being under the cap to mean anything.