D4 openings?
 
    
  
  
  I’m wondering if the queen’s gambit can be completely avoided by playing a certain move for black, not if a certain variation can be avoided... I’m fine with playing different variations of the QG
queens gambit accepted / declined, slav and semi-slav defense. and you could look into kings indian defence line as well. these are the most common responses for queens gambit.
 
    
  
  
  1 d4 Nf6 and then you simply can't force him into the Queens gambit. Good thing is that it is rather simple to get the basics into these lines. Play c4, Nf3, e4 if he allows, maybe Bg5, Nc3 and it's all fine.
 
    
  
  
  If you want to get better, I think you should remove the attitude that you are out of clue without opening theory. Opening theories are just to give a understanding of ideas and plans.
You should treat opening the way you treat middlegame. Always stay focused for tactical ideas even in opening.
Learn the general ideas of d4 opening and try to use those ideas as your guide to make plans. But, you must be always cautious. You should be always ready adapt. That's just my own principle. Believe it or not, I didn’t study any d4 opening theories in my life other than albins counter gambit and the well known trap in queens gambit accepted. For e4, I only studied some traps. I did study Maxlange attack, Morphy attack and evans gambit in Italian. I have some idea of french defense. But, didn’t study any theories for that. Same goes for sicilian. I just learned from trial and error.
I'm not saying I'm proud of not studying the openings. It's not an example you should follow. My point is, I lerned to adapt which is very helpful. Don't play mindlessly like a robot. Learn to adapt. But, don't get me wrong. I'm not discouraging opening study.
 
    
  
  
  I want to learn the queen’s gambit, but I wonder what I have to prepare if my opponent plays out of my prep? Which moves avoid the queen’s gambit, and what do I do against them?
yes, black can easily avoid the QG. The best responses to avoid it are 1.Nf6 (leading to Inidian defenses like the King's Indian Queen's Indian, Bogo Indian, Nimzo-Indian and they can be very annoying and recquire a lot of prep), 1.f5 which is the dutch also recquires some prep because it is not well known enough to be able to play from knowledge.
 
    
  
  
  Now, if you know your opponent, and knows that, for instance, they like to play the Marshall, that’s a different matter. But playing random people? Nah.
 
    
  
  
  Yes, Black can play the KID or the Nimzo. That said, The Queen's Gambit is a classic that has been played by almost all masters. It is also logical and easy to understand. So learning some ideas of the opening is quite useful as some of those themes (minority attack, freeing the light square bishop etc.) reoccur in other openings too.
 
    
  
  
  Now, if you know your opponent, and knows that, for instance, they like to play the Marshall, that’s a different matter. But playing random people? Nah.
I agree based on my own experience
I want to learn the queen’s gambit, but I wonder what I have to prepare if my opponent plays out of my prep? Which moves avoid the queen’s gambit, and what do I do against them?