Traditionally what was used by plumbers and model engineers to prevent solder sticking where not wanted was plumbers black. You paint it on the pipe then scrape it back to a straight line and the solder won't stick to the black stuff.
Unfortunately I don't think it's widely available any more...