Use the form of legend() that has at least two outputs. This is important, because when there are two or more outputs, legend() constructs the objects a different way.
The second output will be an array of handles to graphics objects. If you are careful about which of those you pick out, you can change the graphics objects to make the bar invisible. Do not try to delete the graphics object that forms the bar: that would mess up the way that legend cross-references its objects.

