You simply lose it. Selling the dragon removes it from your account and gives you nothing in return — there's no currency or item exchanged.
So treat it as a permanent goodbye rather than a trade. If you're unsure, it's worth checking whether the dragon can be stored or moved somewhere first, because the action can't be undone once confirmed.