From Latin 'desperare' (to be without hope) — literally 'de-hoping.' Same root as 'desperate' and, inversely, 'prosper.'
From Old French 'desperer' (to lose hope), from Latin 'dēspērāre' (to be without hope), from 'dē-' (away from, reversal) + 'spērāre' (to hope), from 'spēs' (hope, expectation). The PIE root is *speh₁- (to thrive, to succeed, to fare well) — the same root underlying Latin 'prosperus' (prosperous, favourable) via 'pro-spēs' (for hope). Despair is literally the surgical removal of hope: the prefix dē- does not merely negate but strips away. Old French passed the word to Middle English 'despeiren' in the 14th century. The same root surfaces in Spanish 'esperar' (to hope, to wait) and Italian 'sperare' (to hope), showing
'Despair,' 'desperate,' 'desperado,' and 'prosper' all share PIE *speh₁- (to succeed). Despair is 'un-hoping.' Desperate originally meant 'having lost all hope.' A desperado is 'one without hope' (therefore reckless). And 'prosper' means 'according to hope' — hopes fulfilled. The same root runs from total loss to total success.