In most countries there's no law to stop you but hotels and resorts don't like it since it undercuts a profitable revenue stream.
Taking your BYO alcohol to the poolside or into other public areas is to invite a telling-off, but if you're reasonably discreet, and as long as you consume your alcohol in your room, you shouldn't have a problem. However some countries maintain a hardline stance against the importation of alcohol and the one that affects travellers the most is the Maldives. Any alcohol brought into the country will be confiscated when you enter.
This plays right into the hands of the Maldives' tourism industry, since resorts then whack on massive surcharges for alcohol. Most hotels and resorts are silent on the issue but if you're planning to BYO it's a good idea to check. For example Long Island's Palm Bay Resort in the Whitsundays is a self-catering resort, and although guests are welcome to bring their own food, "Please note we are fully licensed and have a strict no BYO alcohol policy."