My opinion is the following: It is not a sin to not wear a Yamulka nor do you fulfill any Biblical or Rabbinic commandment for wearing one. It is an old Jewish custom to wear one. In fact Moses didn't wear one. The Yamulka originated I think some time during the second temple era as a Jewish custom and is brought down in Judaism as a custom that should be followed (interestingly enough the Shulchan Aruch or Jewish code of law says that it's forbidden to walk a few feet w/o wearing one so perhaps he thinks that it is a Rabbinic decree, but I personally strongly disagree with this and can't find an older source that says it is anything more than a custom). The reason for wearing the Yamulka on our heads is to remind us that G-d is watching over us so we should always fear heaven and act appropriately. Another reason is to distinguish ourselves as Jews in public so as to sanctify G-d's name when we act according to the Bible and do good deeds so the non-Jews will admire us and sanctify G-d's name.
I, my father and my father's father did not wear the Yalmuka to work in a mostly Gentile workplace for various reasons, mostly because of anti semitism or if it will hinder your job performance. I wear it outside of work and when I work in a Jewish area. Anything that covers the head may be used so a hat is also fine. I wear a baseball hat in a bad neighborhood.