I would imagine the answer here would be country-specific, but it seems that in most countries the immigration rules are not friendly to remote workers, and you do indeed need a work visa if you want to follow the letter of the law. For example, I know this could be a problem in the USA, Japan and Thailand. In Thailand, I even heard of a co-working space being raided by immigration officials to find people illegally working online while on tourist status.
However, as I understand it, such enforcement is very rare. The spirit of the law, after all, is to prevent you from taking jobs from a local, and if you work online you're no more likely to do that inside a country than outside of it. And you're actively contributing to the country's economy by earning outside it but spending inside. As long as you don't stand out from the general tourist population (unusual items in luggage, participation in work-like events, excessive visa renewals / visa runs), you should realistically be fine in a lot of countries. I suggest you read the various sites and blogs about the topic of "digital nomads" - there are entire communities of people devoted to finding great places to work remotely, and these communities are probably better suited to ask detailed questions about the legal aspects in each specific country.
By the way, I have heard some indication that having an incorporated entity in a place where you are allowed to work can help. You are then not a sole proprietor working for yourself in a far-away country, but you are merely an employee of XYZ Inc. in your own country, on a long vacation in a faraway country, occasionally performing the odd task for your remote corporate employer but technically not working locally. Obviously this happens all the time with employees of actual large corporations who travel, I don't think it's reasonable to assume that they never answer any work-related emails while overseas. Please take this advice with a huge grain of salt, I am not a lawyer, much less a lawyer in any South American countries : )