First point that you're forced to make a faction hostile (in other words, locked out of an ending) is a quest called "Mass Fusion". You can make factions hostile before then by doing some blatant things like kill a ton of their members at their headquarters in middle of a bunch of witnesses, but this is the first storyline mission the choices you make for that mission make someone hostile. A save where you first get Mass Fusion is a pretty good branching off point.
There is an "exception", however. If you really want Paladin Danse's perk but want to side with the Institute, complete Liberty Reprimed before completing the "Talk to Allie Filmore" objective of Mass Fusion. That's because Liberty Reprimed and the next objective in Mass Fusion require you to talk to the same NPC in the Brotherhood. If you talk to that NPC, they will not talk to you about Liberty Reprimed until after Mass Fusion is done, and you don't have a choice. Mass Fusion forces you to either make the BoS or the Institute your enemy.You need to do Liberty Reprimed for the perk because a quest that will be given after Liberty Reprimed is given and that quest's completion is necessary for the perk.