It is not allowed to perform Hajj on behalf of a captive, whether he gives permission to do so or not.
In this regard, the eminent Muslim scholar, Sheikh Yusuf Al-Qaradawi, states:
Originally, Hajj is a duty to be performed personally, as Allah Almighty says: (And that man hath only that for which be maketh effort.) (An-Najm 53:39) However, Allah the Almighty, out of His Mercy, has granted us some concessions and dispensations (rukhsah) under certain conditions and circumstances, to perform acts of worship on behalf of others. For example, if a person dies without performing Hajj, it is allowed for his son to perform Hajj on his behalf, according to an authentic Hadith. So is the case for the elderly or the chronically ill who are not able to perform Hajj themselves.
As for the captive, he is supposed to be released and set free, because everything is liable to change and nothing is destined to stay forever. Allah says: (Such days (of varying fortunes) we give to men and men by turns.) (Aal-`Imran 3:140) And we should not lose hope in Allah’s victory and Mercy.
Thus, it is not right to draw an analogy between Hajj on behalf of the captive and performing it on behalf of the deceased or the aged. It is not allowed to perform Hajj on behalf of the captive, whether he gives permission to do so or not.