Why does the author keep the name of the barber and the setting unknown?
In my opinion, the reason to do this is to make the story seem more universal and less tied to any one particular place.
If you look at this story, all you really know is that it probably takes place somewhere where the people speak Spanish. We know this because the captain's name is Torres. Outside of that, it could be anywhere.
When a story is set in some place, it makes it harder to identify with the characters. It becomes a story from that place and if you don't live there, you might think it has nothing to do with your life.
But by making it more anonymous and placeless, the author makes it feel like it could be anywhere and so we should all pay attention to its message.