Where did Martin Luther say Temptations, of course, cannot be avoided, but because we cannot prevent the birds from flying over our heads, there is no need that we should let them nest in our hair.
It's in Luther's Explanation of the Lord's Prayer, Sixth Petition ("And lead us not into temptation"), paragraph 161.  Sample collection that includes the work is Luther on Christian Education, 1907, 12MB PDF which includes:


Luther's Small Catechism
Large Catechism
Explanation of God's Ten Commandments
Explanation of the Apostle's Creed
Explanation of the Lord's Prayer
Explanation of Holy Baptism
Explanation of Confession
Explanation of the Lord's Supper.


For historical interest, here's full quotation.  I'm impressed at how detailed the explanation is.  Makes me want to read the whole thing !


  THE SIXTH PETITION.
  
  "And lead us not into temptation."
  
  
  If the word "temptation" or "allurement" were not
  so much in vogue it would be better and clearer to say:
  And lead us not into trials. But in this petition we learn to
  realize the wretchedness of our life upon earth. For it is all
  trial; no man who is wise will look for peace and security
  here; he can never attain to such a condition. And though
  we all should desire it, it is still in vain. A life of trial it is
  and remains.
  Therefore we do not say, Take the temptation from me, but, Lead us not into it. What the supplicant means to
  say is. We are surrounded with temptations on all sides and
  cannot escape them, but, O our Father, help us not to enter
  into them, that is, not to consent to yield to them and so be
  overcome and overthrown. He who yields to temptation
  sins and becomes a captive of sin, as Saint Paul says, Rom
  7,23.
  Therefore, this life is, as Job says (7, 1), nothing but
  a warfare and a perpetual conflict with sin. And the dragon,
  the devil, continually assaults us and endeavors to draw us
  into his jaws. Saint Peter says : Dear brethren, "be sober,
  be watchful: your adversary the devil, as a roaring lion,
  walketh about, seeking whom he may devour," 1 Pet 5, 8.
  Behold, Saint Peter, our dear father and faithful bishop, says
  that our adversary seeks us, not at any particular place,
  but everywhere and at every point. He incites, stirs and
  troubles ail our members and senses from within and without.
  From within, by evil suggestions; from without, by
  wicked images, words and acts. Men and every creature
  are his agents. Unchastity, wrath, pride, covetousness and
  other sins are the objects of his temptations, and he uses
  every cunning device to induce us to yield. As soon as we
  feel so inclined let us swiftly raise our eyes to God in prayer
  :
  O God, Father, see how I am moved and tempted to this
  or that vice; see how I am hindered in this or that good
  work. Guard me, dear Father, and help me; let me not
  succumb and yield to it. How blessed would he be who
  would rise and apply this petition faithfully! There are
  many who know not when they are tempted nor what they
  should do in temptation.
  What is temptation? It is of two kinds. On the
  one hand, that which incites to anger, hate, bitterness, displeasure,
  impatience; such as sickness, poverty, dishonor
  and everything painful, especially the annoyance of having
  one's will or purpose, one's opinion, counsel, word or work
  rejected and despised. These things are of daily occurrence
  in this life, and God inflicts them through evil men or devils.
  If one feels a wrong impulse, he ought to be wise
  and not be taken by surprise, for such is the course of this
  life. He ought to draw forth this petition as a true bead
  in the rosary of prayer, and say : O Father, here is certainly
  a temptation, which is come upon me ; help me, that it may
  not result in my seduction and overthrow.
  When temptation assumes this form two kinds of
  foolish conduct are possible. First, when we say: Indeed,
  I would be pious and not get angry if I had peace. And
  some give our Lord God and his saints no rest until he
  takes the temptation from them. He must heal this man's
  leg, make that man rich, let this man secure justice. And
  they do whatever they can by their own efforts and the
  efforts of others to extricate themselves, and so they remain
  lazy and cowardly knights, unwilling to sustain attack, or
  to fight. Therefore, they are not crowned; ay, they fall
  into the opposite temptation, as we shall hear. But the
  proper course is not to slip by the temptation nor to escape
  it, but in knightly valor to conquer it. This is the sentiment
  which Job expresses when he says (7, 1) : "Is there not a
  warfare to man upon earth?"
  The others, who neither overcome the temptation
  nor are relieved of it, plunge into anger, hate, impatience;
  give themselves entirely to the devil ; work evil by word and
  w^ork; become murderers, robbers, slanderers, perjurers,
  backbiters, and makers of all kinds of mischief. The temptation
  has conquered them and they yield to every evil impulse.
  The devil has them altogether in his power and they are
  his captives. They invoke neither God nor his saints. But
  inasmuch as our life is called a temptation by God himself,
  and it is unavoidable that we are subjected to offenses and
  injustice in body, property and honor, we ought to look
  forward to trials with unruffled minds, receive them in a
  spirit of wisdom when they come, and say: Ah, such is the
  nature of life, what am I to do? It is and remains a temptation.
  It cannot be otherwise. God help me that I may
  not be moved and overthrown.
  Thus you see that temptation can be avoided by
  no one ; but resistance may be made and, with prayer and 
  recourse to divine aid, we can put ourselves in readiness to
  meet such designs. In the book of an old father we read
  that a young brother expressed a desire to be rid of his
  thoughts. Thereupon the old father said: Dear brother,
  you cannot prevent the birds from flying in the air over your
  head, but you can prevent them from building a nest in
  your hair. So, as St. Augustine says, we cannot prevent
  offenses and temptations, but by prayer and invocation of
  the help of God we can prevent them from overcoming us.
  On the other hand the temptation is that which incites
  to unchastity, lasciviousness, pride, avarice, vainglory
  and everything that pleases. Especially does this kind of
  temptation come when one is permitted to have his way;
  when his words, counsel and deeds are praised ; and when he
  receives much honor and appreciation.
  This is the most dangerous temptation, characteristic
  of the time of the Antichrist. So David says in the
  Psalm (91, 7) : "A thousand shall fall at thy side, and ten
  thousand at thy right hand." Its spread at the present
  time is alarming. For the world strives only for wealth,
  honor and pleasure. In particular is it true that the young
  acquire no training for the fight against temptation and
  carnal lust. They fall without an effort. Nothing is considered
  disgraceful any more. The whole world is full of
  lecherous songs and stories, as if this were the proper thing.
  In all this we witness the fearful wrath of God, who permits
  the world thus to fall into temptation because nobody calls
  upon him.
  It is indeed a sore temptation for a young person
  when the devil fans his flesh into a flame, sets marrow,
  bone and every member on fire, and, at the same time,
  incites him from without by seductive objects in the form
  of gestures, dances, clothes, words and attractive pictures of
  women or men. As Job says (41, 21) : "His breath kindleth
  coals." The world is now altogether mad in its devotion
  to dress and jewelry. But it is not impossible for us to
  overcome all this, provided we are in the habit of calling
  upon God and praying: "Father, lead us not into temptation."
  This should be our prayer also when tempted to
  pride in consequence of receiving praise and honor; likewise
  when wealth or any worldly boon falls to our lot.
  Why does God permit men thus to be tempted to
  sin? Answer: That man may learn to know himself and
  God. To know himself—that he can do nothing but sin and
  evil. To know God—that God's grace is mightier than all
  creatures. Thus man shall learn to despise himself and to
  praise and glorify God's grace. For there have been those
  who have tried to withstand unchastity by their own powers,
  by fasting and work. They have broken down their bodies
  thereby and yet have accomplished nothing. For evil desire
  is extinguished by nothing except the heavenly dew
  and rain of God's grace. Fasting, work and watching must
  indeed accompany it ; but they are not sufficient.
  
  
  Conclusion of the Petition
  
  
  Now, when God has forgiven us our debts, nothing
  is so much to be guarded against as the danger of falling
  again. For, as David says (Ps 104, 25), in the sea of this
  world are creeping things innumerable ; that is, many temptations
  and stumbling-blocks, which would draw us back
  into guilt. It is necessary that, without ceasing, we speak
  from our hearts : Father, lead us not into temptation. I do
  not ask to be altogether free from temptation, for that would
  be disastrous and worse than ten temptations like those first
  mentioned; but I ask that I may not fall and sin against
  my neighbor or thee. St. James says : "Blessed is the man
  that endureth temptation," Ja 1, 12. Why? Because temptations
  exercise a man, and perfect him m humility and patience,
  and make him acceptable to God, as his dearest children
  are. Blessed is he who takes this to heart. Now, alas!
  everybody seeks rest, peace, pleasure, and comfort in this
  life. Therefore, the reign of Antichrist is approaching, if
  indeed it is not already here.