The Gemara in Pesachim 112a records Rabbi Akiva's instruction not to enter one's own house suddenly without knocking, and all the more so not to enter another's house suddenly, since the occupant may not be prepared to receive a visitor.
This is sharpened in Niddah 16b, which lists entering another's house suddenly, without warning, among things the Holy One hates, and Rabbi Yochanan extends this even to entering one's own house without prior warning, since household members might be engaged in private activities; Rabbi Shimon ben Yochai reiterates this as one of four hated matters.
Mishlei 25:17 counsels restraint in how often one visits a neighbor's house, lest the neighbor grow weary and come to resent the visitor, reinforcing a broader sensitivity to intruding on another's space.
Among the later authorities, Nitei Gavriel (Yichud, perek 33) addresses entering without knocking in the specific context of yichud concerns, distinguishing Torah-level from rabbinic-level yichud and concluding that leniency may apply where unannounced entry is the accepted custom in a given setting, while Nitei Gavriel (Yichud, perek 32) holds that when the person inside hears a knock or doorbell, asks who is there, and opens the door, there is no violation of yichud so long as the visitor arrives at a time when people commonly come to the home, even without prior notice.
Igros Moshe (EH 4:65) rules on this very question of knocking or ringing before entry, holding that when someone knocks or rings a designated bell, the person inside asks who it is and opens after recognizing the visitor or understanding him to be an ordinary person, and that there is no prohibition of yichud when ordinary people are likely to enter the home in that manner.
Nishmat Shabbat vol 5:124 permits knocking on a door with a noise-making device when normal entry is not possible at night, treating this as a mitzvah and a significant need, and also discusses the scenario of a Jew opening the door when a non-Jew rings it.
A narrower practical case appears in Kitzur Shulchan Arukh Yalkut Yosef, Orach Chaim 276:8, which addresses a door opened by an electric buzzer operated by a non-Jewish doorman, permitting entry if manual opening by key is also possible, and otherwise advising one to wait and enter together with a neighbor for whom the door is opened, with the suggestion to arrange this properly before Shabbat.