The meanings of 不好意思
不好意思 has two meanings which are quite similar but applied differently. Quoting from 汉典 (English translation mine): 


  ①表示碍于情面而只能怎样或不便怎样。(to indicate a face-saving compromise)


This is usually used as a form of acknowledgement and indirect acceptance of another person's kindness or generosity when none is expected. The person saying it usually has little choice, either because he is in desperate need for help or it would make the situation embarrassing if he refuses the generosity.


  ②害羞；难为情。(feel shy or embarrassed about the situation)


This is used in situations where one would feel embarrassed for troubling someone else. The level of embarrassment can be quite abysmal though, especially when spoken in sarcasm or when used for very minor things like asking for directions.


  Does 了 occur here only in response to a kindness, and not in
  describing a bad thing?


To answer your question, 了, does not determine the meaning of 不好意思. The reason why you may think so is due to the way you apply the first meaning of 不好意思 at the end of a sentence. Some examples to demonstrate why this is not necessarily the case:


真不好意思，又让您破费了。(without 了 ①)
不好意思，厕所在哪里？(asking for directions ②)
她被夸得不好意思了。(counter example ②)
不好意思了大家，我已经上岸了，你们继续摸石头吧。(counter example with sarcasm ②)