Jesus is preaching in the Temple at the Feast of Tabernacles. The people of Jerusalem have cast doubt on his Messianic claims because "we know this man whence he is: but when Christ cometh, no man knoweth whence he is" (John 7:27).
 Then cried Jesus in the temple as he taught, saying, "Ye both know me, and ye know whence I am: and I am not come of myself, but he that sent me is true, whom ye know not.  But I know him: for I am from him, and he hath sent me."
It is not clear if the people were audibly criticizing Jesus while he was teaching, or if we are to understand that he knew their thoughts be supernatural means.
We are told that Jesus is widely believed to be the son of Joseph (John 6:42), born in Nazareth and not Bethlehem (John 7:42). When the people say "we know this man whence he is," Jesus agrees -- "Ye both know me, and ye know whence I am." This strongly implies (contra Matthew and Luke) that Jesus really was the son of Joseph, born in Nazareth.
Jesus seems to concede that they know his parentage and place of birth, but that they still do not know fully "whence he is." This is because he was sent by God and is therefore "from" God. Since they do not know God, they cannot truly be said to know where Jesus is from. This is how Jesus reconciles the facts about himself with the expectation that "when Christ cometh, no man knoweth whence he is": the Messiah is sent by God, and comes in a time when no man truly knows God.
This rejoinder seems to rely very heavily on the specific wording of the criticism, playing on a possible ambiguity of "whence he is." It does not address the possible biblical sources of the criticism, about being of unknown "generation" (Isa. 53:8), coming "with the clouds of heaven" (Dan. 7:13), or coming "suddenly . . . to his temple" (Mal. 3:1). This makes me think that the belief that "no man knoweth whence he is" had some other source -- perhaps an oral tradition, or perhaps some biblical text modern commentators have not yet noticed.
The Jewish expectation that the Messiah would be "unknown" is put in the mouth of Justin Martyr's Jewish interlocutor in the Dialogue with Trypho (c. AD 155-160). It is unclear whether the dialogue really took place and how closely the "Trypho" character reflects the views of the historical rabbi for whom he is named, but it seems likely that an apologetic text would, for practical reasons, address current beliefs, even if the dialogue itself is a fictional device.
In Chapter 8 of the dialogue, Trypho says,
But Christ -- if he has indeed been born, and exists anywhere -- is unknown, and does not even know himself, and has no power until Elias come to anoint him, and make him manifest to all. And you, having accepted a groundless report, invent a Christ for yourselves, and for his sake are inconsiderately perishing.
This is interesting -- the idea that the Messiah would not even know himself until he was anointed by Elijah. The Synoptics identify John the Baptist with Elijah. This identification is not present in the Fourth Gospel (in fact John specifically denies being Elijah in John 1:21), but it is interesting in the context of this Jewish expectation that John first says "there standeth one among you, whom ye know not" (John 1:26) and then later identifies this person as Jesus, saying, "I knew him not: but that he should be made manifest to Israel, therefore am I come baptizing with water" (John 1:31). John believed that his role was to make the unknown Messiah known -- perhaps even to himself?
Was anointing part of John's baptismal ceremony? It is never explicitly mentioned as such, but ceremonial washing and anointing go hand in hand in the Old Testament (e.g. Ex. 29:4-7).
Later, in Chapter 44, Trypho makes this curious comment (the brackets are not mine but the translator's).
For we all expect that Christ will be a man [born] of men, and that Elijah when he comes will anoint him. But if this man appear to be Christ, he must certainly be known as man [born] of men; but from the circumstance that Elijah has not yet come, I infer that this man is not He [the Christ].
According to Trypho here, the Jewish expectation was not that the Messiah was to be of unknown birth or parentage; on the contrary, "he must certainly be known as man born of men." It seems likely that this was a genuine Jewish expectation, since Justin (a proponent of the Virgin Birth) would have gained nothing by putting it in the rabbi's mouth.
If the Dialogue with Trypho is any guide to the beliefs of Jesus' contemporaries, "when Christ cometh, no man knoweth whence he is" means not that the Messiah would be a man of mysterious origin, that no one would know where he was born or who is parents were; but that until Elijah actually anointed him, no one would be able to predict who he would be. It would come as a surprise to everyone, including the newly anointed Messiah himself! The meaning of the criticism may have been: This man (presumed not yet to have been anointed by Elijah and thus not yet the Messiah) is already famous, and there are already lots of rumors that he may be the Messiah; but we know that the true Messiah will "come out of nowhere," a previously unknown figure suddenly elevated to that position by Elijah.
Why was it believed that Elijah would anoint the Messiah? The only hint of this I can find in the Old Testament is in Malachi.
Behold, I will send my messenger, and he shall prepare the way before me: and the Lord, whom ye seek, shall suddenly come to his temple, even the messenger of the covenant, whom ye delight in: behold, he shall come, saith the Lord of hosts. . . . and he shall purify the sons of Levi (Mal. 3:1, 3).
There are two messengers here: The first prepares the way for the second, and this second is "the Lord" (ha-adon), possibly the Messiah. Later in Malachi, we read,
Behold, I will send you Elijah the prophet before the coming of the great and dreadful day of the Lord: And he shall turn the heart of the fathers to the children, and the heart of the children to their fathers, lest I come and smite the earth with a curse (Mal. 4:5-6).
Reading these two passages in light of each other, it is natural to conclude that the first messenger is Elijah, and that "the great and dreadful day of the Lord" is the coming of the second messenger, the Messiah.
Which of the two "shall purify the sons of Levi"? Perhaps it is Elijah. (I discuss this vis-à-vis the idea that Elijah would baptize in my notes on John 1.) Malachi 2 holds up the patriarch Levi as an example of righteousness and enjoins the priests (a subset of the "sons of Levi") to return to the ways of their great ancestor. Thus, purifying the sons of Levi could involve turning "the heart of the children to their fathers," which is what Elijah is to do. In the Torah, mere Levites (descendants of Levi but not of Aaron) were purified by water, but priests (descendants of both Levi and Aaron) were both washed and anointed. Thus we might conclude that Elijah will be washing and anointing people and preparing the way for the Messiah. Since the Messiah must himself be anointed (that being what the word messiah means), it is natural to assume that Elijah would do it.
Since Malachi 3-4 is the source of this whole "return of Elijah" thing, Malachi 3:1 remains the only convincing source of the idea that the Messiah would appear "suddenly" and not be known in advance.
As usual, Jesus is not really interested in "Bible-bashing" or refuting his critics on their own terms. He could have said, "Actually, no one knew who I was until Elijah -- who is John -- discovered me, and here I am appearing suddenly in the Temple just as prophesied." Instead, he only uses the criticism as a point of departure, and zeroes in on what is really important: You don't accept me because you don't know God.
 Then they sought to take him: but no man laid hands on him, because his hour was not yet come.
The Greek could mean that they tried to seize him but couldn't, or that they wanted to seize him but didn't dare. I think the latter reading is more probable. Jesus continues teaching after this, apparently still in the Temple. There is no indication that he ran away, or that anything happened to stop those who were trying to take him. My reading is that they wanted to arrest him right away but thought, as the chief priests are reported to have said on another occasion in the Synoptics, "Not on the feast day, lest there be an uproar among the people" (Matt. 26:5, cf. Mark 14:2).
The author adds, though, that the real reason Jesus was not yet arrested was providential: "his hour was not yet come." Only the Fourth Gospel has these references to Jesus' hour or time not yet having come. In John 2:4, Jesus is at first unwilling to provide wine for wedding guests because his "hour is not yet come"; however, he ends up providing the wine miraculously anyway, seemingly right away. In John 7:6-8, he says he's not going to the Feast of Tabernacles because his "time is not yet come," but he ends up going anyway a few days later. Here (John 7:30) and in John 8:20, Jesus' arrest and execution are providentially postponed until his hour has come.
It is evident that the timing of everything Jesus did was extremely important, and that a few days (going to the feast) or even hours or minutes (providing wine) could make a difference.
 And many of the people believed on him, and said, "When Christ cometh, will he do more miracles than these which this man hath done?"
 The Pharisees heard that the people murmured such things concerning him; and the Pharisees and the chief priests sent officers to take him.
The basis of the people's belief was simple: He did lots of miracles, so he must be the Messiah. Why did the Pharisees so confidently disbelieve? Because they were steeped in scripture and the interpretative traditions that had grown up around it, and they had a long list of highly specific expectations regarding the Messiah. We saw this in John 6:30, where they could still say "What sign showest thou?" after witnessing miraculous healings and the feeding of the 5,000, because Jesus had not yet produced the omer of manna their fathers ate in the wilderness, a specific requirement derived very indirectly from Deuteronomy.
I feel this has the makings of a good bell curve midwit meme.
 Then said Jesus unto them, "Yet a little while am I with you, and then I go unto him that sent me.  Ye shall seek me, and shall not find me: and where I am, thither ye cannot come."
It seems inarguable that v. 33 refers to Jesus' coming death and subsequent ascent to Heaven. What, then, is meant by v. 34?
Since recent references to the Jews "seeking" Jesus (vv. 1, 25, 30) have referred to their seeking to kill or lay hands on him, the most natural reading is, "I'm going somewhere where you won't be able to catch me." As William W. Phelps wrote after the assassination of Joseph Smith, "Traitors and tyrants now fight him in vain . . . Death cannot conquer the hero again." Upon reflection, though it's a pretty strange thing to say before one’s death, to the very people who are going to have one killed. "You'll never be able to kill me -- I mean, you will, but only once! After that, you'll never be able to kill me again!" More to the point, why would anyone even be seeking to kill Jesus after he had already been publicly executed and was known to be already dead? He rose from the dead, true, but his enemies didn't believe that. He made several private appearances to his disciples after his resurrection, but he wasn't waltzing around Jerusalem as a public figure, inviting a second round of attempts on his life. There were plots to kill the risen Lazarus (John 12:10) but none to kill the risen Christ.
Another possible reading is that the same Jews who now want him dead will later have a change of heart and seek him as disciples, to follow him and be saved -- but that it will be too late. That can't be right, though. Repentance is always possible, and "he that seeketh findeth" (Matt. 7:8, Luke 11:10). Also, empirically, it doesn't appear that any of the Jews who plotted against Jesus had a change of heart after his death and resurrection. And if they had, the example of the anti-Christian Pharisee Saul of Tarsus, who became Saint Paul, suggests that they would have been forgiven and accepted as disciples.
Perhaps Jesus means that they will not seek him, Jesus of Nazareth, as such, but rather "the Messiah" (who is Jesus, though they do not recognize him as such). In the catastrophes to be poured out on Judaea in the decades after Jesus, particularly the sacking of Jerusalem and the destruction of the Temple in AD 70, the Jews will cry out for the Messiah to come and save them -- but no Messiah will come, because he already came, and they rejected him. This interpretation is strengthened when Jesus repeats this statement in the next chapter: "I go my way, and ye shall seek me, and shall die in your sins: whither I go, ye cannot come. . . . for if ye believe not that I am he" -- i.e., that I, Jesus, am the Messiah -- "ye shall die in your sins" (John 8:21, 24).
Jesus later says much the same thing to his own disciples: "Little children, yet a little while I am with you. Ye shall seek me: and as I said unto the Jews, 'Whither I go, ye cannot come'; so now I say to you" (John 13:33). The crucial difference is that he only says, "ye shall seek me" -- without adding "and shall not find me" or "and shall die in your sins."
For thus saith the Lord, That after seventy years be accomplished at Babylon I will visit you, and perform my good word toward you, in causing you to return to this place. . . . Then shall ye call upon me, and ye shall go and pray unto me, and I will hearken unto you. And ye shall seek me, and find me, when ye shall search for me with all your heart. And I will be found of you, saith the Lord: and I will turn away your captivity, and I will gather you from all the nations, and from all the places whither I have driven you, saith the Lord; and I will bring you again into the place whence I caused you to be carried away captive (Jer. 29:10-14).
Roger Hathaway maintains that the word gentile in the Bible never means "any non-Israelite" and often specifically refers to the Israelites.
 Then said the Jews among themselves, "Whither will he go, that we shall not find him? will he go unto the dispersed among the Gentiles, and teach the Gentiles?  What manner of saying is this that he said, 'Ye shall seek me, and shall not find me: and where I am, thither ye cannot come?'"
The Greek word, "ethnos" (,θvoς) means exactly the same as the Roman word, "gens." When "ethnos" (,θvoς) was used by Jesus or others, they didn't mean "non-Jews;" they meant "those of our own ethnic group: Israelite tribes." Occasionally the word referred to some other specific ethnic group, but it never meant "all nations of the world other than the Jews!"
The Gospel of Mark uses the word "gentile" only two times and those passages are already covered above, in Matthew. Luke uses the word five times and most are repeats of uses in Matthew. John never uses the word in his Gospel.