By bar, I mean the wooden rectangle (the counter) not the establishment. In that case, should I say, "to sit at the corner of the bar" or "to sit in the corner of the bar"?
You wouldn't sit in a wooden rectangle would you? You might sit in an establishment. So you would sit at the bar. To answer your question the prepositional phrase you are looking for is "to sit at a corner of the bar" as in:
The place was so crowded I had to sit at an uncomfortable corner of the bar.
as opposed to:
The place was so crowded I had to sit in a dark corner of the bar.