An Air Force first sergeant has been dismissed by his commanding officer for declining to state his beliefs on same-sex marriage.