Travel to US through Third Country

If I have a valid US visa, can I travel to US via thrid country? Lets say I travel to Maldives and stay there for 14 days and after that travel US.
Is there a possibility of denying entry to US?
I think technically nothing wrong in this.

You can travel via 3rd country after a stay over of 14 days provided the country is not in the travel ban list.