Boiling as apparent violation of the second law of thermodynamics One of the statements of the second law is that no agency can be built whose sole effect is to convert some amount of heat entirely to work.
But in case of boiling, the temperature being constant, entire heat supplied is converted into work, namely the work done by water against ambient pressure to expand to the vapour state.
At which point am I going wrong?
 A: You misquoted the 2nd law.  Here is what it really says (Moran et al, Introduction to Engineering Thermodynamics): 

It is impossible for any system to operate in a thermodynamic cycle  and deliver a net amount of energy by work to its surroundings while receiving energy by heat transfer from a single thermal reservoir.

So, when water boils and does work, it doesn't violate the 2nd law and when you expand or compress a gas isothermally in a cylinder, it doesn't violate the 2nd law.
A: When water boils, the heat mostly goes into breaking the bonds between water molecules. Suppose you boil mass $m$ of water under constant pressure $P$. The work done due to expansion is
$$
A=P(V_\text{gas}-V_\text{liquid}),
$$
and one can estimate
$$
PV_\text{gas}\simeq NkT,
$$
where $N$ is the number of molecules in mass $m$. And so we get, for $V_\text{gas}\gg V_\text{liquid}$,
$$
A\simeq NkT.
$$
That is, the work is $kT$ per molecule. On the other hand, the hydrogen bond binding energy in water is on the order of $0.2$ eV, if I rememeber correctly. That is equivalent to temperature $0.2\cdot 10^4=2000$ K, and you have to break on the order of 2 hydrogen bonds. Therefore, at room temperature, only several percent of heat actually goes into work, while most of it goes into breaking the bonds between molecules.
A: When things are heated electromagnetic rays are emitted, "black body radiation" I think, hence the reason why hot iron glows. As the radiation is emitted, the energy in the boiling device is dispersed into the surrounding, even if the surrounding is vacuum. (Also the reason why things in space cools down and freeze)
