Let's say I am thinking about making an Indian protagonist who lives in India when I've never lived there, don't know anyone who is Indian and don't know anything about Indian culture. Should I even consider it? The book I would write could end up being extremely offensive. I can think of some situations where it's ok. For example, if my protagonist is stranded on an island and lives by himself, then I think it's safe to say it doesn't really many which ethnic group my protagonist would belong to, but if there are many characters and the story is set in India, it could spell trouble for me.
You don't need to have been to India, or know any Indian. I would suggest you research about India, and find about its culture. Some Indians might find it offensive if you don't research and put incorrect information, and you probably don't want to take the risk.
The simplest answer is: Research.
There is no justification for not doing the research. If you know nothing of the culture, don't use it. If you want to use it, go learn about it. You are very highly likely to offend by having a character whose cultural heritage you are in the dark on. You are also very likely to need to rely on stereotypes to get you through the murkier bits of character development. Those stereotypes will almost unequivocally be offensive. And lastly, without understanding the culture your character will likely be inauthentic and flat (the least of your worries though.)
This can all be assuaged with research. Learn about the culture and then you can consider writing about it (with tact.) There is no excuse for not being willing to put in the effort to learn about a people before you have the audacity to write about them as if you knew them.
Let's say I am thinking about making an Indian protagonist who lives in India when I've never lived there, don't know anyone who is Indian and don't know anything about Indian culture. Should I even consider it?
No. No you should not.
You're wanting to write about a place you have never been and know nothing about as well as from the perspective of somebody from that culture... If you haven't lived there, don't know anyone from there, and know nothing about the culture, why would you think you'd be capable of writing this? I ask because it seems like you're interested in writing this story, but I can't understand why.
If you do still want to write the story, then you need to analyze as much as you possibly can about Indian culture, manners, religion, language (even if speaking English), and so forth to make your characters and story believable. You can't just write the story as if you are writing a story starring Americans.
It's not that you shouldn't write the story at all. You just shouldn't do so at this time. Study and research the topic so that you can do your best possible job. Otherwise, you're better off with just writing what you know.
If writers only stick to their own background, we'll be slower to bring diversity into fiction. Besides which, in what ways should your protagonist be like you? If mine have to be white, do they also have to be Silhillian, fat, clever, pro-EU, a software engineer born in 1988 with a half-sibling etc.? What's so special about nationality or ethnicity that I can't be trusted to sympathise with someone different? If anyone can not only do that but also help others to do so, history shows it's great writers.
But be prepared to change your story as you learn. You don't want to be the Aladdin author who thought China was full of Muslims with the occasional Jew. You want to be the team behind Coco, who cancelled their plan for the film to be about letting go of a dead mother when they learned the whole point of Día de Muertos is instead to remember the dead.
You don't do it, by the way, to be inoffensive. A ridiculous misrepresentation of Indians won't leave them clutching pearls; it'll just be silly and boring. Because when you really understand another culture and what makes it tick, you can give your audience something they've never seen before, which is what people want. Coco had a much more creative story for understanding its topic. It'll make you want to learn Spanish.
Don't dismiss it altogether, but tread with care.
It's good that you're considering the fact that it may be problematic, it's a good starting point.
Why do you want to use that ethnicity?
The first question I would ask in this situation is why do you want to use (for example) an Indian character? Is there some compelling reason to do so? Will the story not work if the character is not Indian?
If yes, then move onto the next point.
But if there isn't then ask yourself whether you might be creating unnecessary complications, when you could write about someone whose culture you understand better - and therefore spend more of your creative energy developing the characters and plot.
Writing a good novel is hard enough without us setting ourselves unnecessary extra hurdles.
As others have said, you can make a lot of progress by doing research. I would argue that it's almost impossible to really understand a culture and recreate it in prose if you haven't experienced it directly - but I don't think it's actually impossible.
The internet could also help you find genuine Indian (or whoever is relevant) people to read over your work when it's done, in order to flag anything that is culturally insensitive, or simply inaccurate.
A friend of mine has been to the US, and obviously the US culture is quite similar to British (which is ours) but he still likes to find someone American to look over his work to catch out terminology that isn't quite right - boots and trunks and all that.
You could post on a critique group and say you are looking for fedback from people of a particular culture.
People write about stuff they haven't experienced directly all the time. People write from the point of view of murderers, vampires, Prime Ministers.
The problem you have is that in those cases the readers won't know any better than you, but, if you're using a major, populous culture, you're more likely to make assumptions that could cause offence, or simply break the suspension of disbelief of your story.
Personally, I don't think it's a good idea to write about a culture you don't understand, partially because you're creating a lot of potential extra work and problems for yourself, and partially because of the risk of offending someone, but if it's important to you and you do it with care and respect, then I think it can be pulled off.