Work is in units of energy. For conservative forces, like gravity here acting on the rocket,
$ W = \Delta KE$
The escape velocity gives you the velocity needed to just escape earth so that $v = 0$ in space. So the minimum energy needed to escape earth is where $v = 0$ in space. When $v = 0$ so too is $KE$.
$ W = KE_f - KE_i = -KE_i = -\frac{GMm}{r}$
where $r$ is the radius of the earth. Just plug into this, and this is the minimum work, ie the minimum energy you need to escape. The negative indicates that the work done by gravity on the ship is negative (ship motion is in opposite direction to force of gravity). The energy done by an external force is positive.
Note that also for conservative forces, $W = -\Delta U$ where $U$ is the potential energy. The expression we found below,
$-\frac{GMm}{r}$
Is the formula for gravitational potential energy. So another way to look at the problem is how to get the gravitational potential energy to zero. On earth the grav potential energy is some negative number. We need to get that number to zero. So by just plugging into the grav potential energy to find what it is on earth, that is how much is needed to get the grav potential to zero. When grav potential is zero, you wont be attracted back to earth.