Let's list up the meanings
The meaning of Sumimasen can be these: I'm sorry; Thank you; Excuse me; Pardon me; You didn't have to do that; It's too much for me; I'm here / Anyone there? ...And much more. When the Japanese say "Sumimasen", it can mean any one of these. However, it's not as complicated as it seems. Here is a really simple solution to master this versatile word.
The simple solution
When Japanese people say "Sumimasen", they are largely feeling more or less "sorry" to bother you. For example, they broke your vase and say, "Sumimasen", because they feel sorry (no wonder). In another case, they say "Sumimasen" when addressing you on a road to know how to get their destination; they are feeling sorry to bother you by stopping you and asking the way. When they are given too great a present suddenly, they say "Sumimasen", for they find themselves not qualified for the great present and feel sorry to receive that. And in this case, this kind of modesty also represents thankfulness.
The core meaning of "Sumimasen"
As you may have noticed, "Sumimasen" is the embodiment of Japanese modesty. They are so humble about themselves that they always try to be polite by taking a low profile. That's the original and core meaning of "Sumimasen". Of course, in this 21th century, this word sometimes can be uttered as a superficial or perfunctory expression for "I'm sorry" as a side effect of the versatility. However, the Japanese modesty is still alive in their mind. So, if you use "Sumimasen" perfectly, they will embrace you as their company.