Throughout the novel, the main character's name is given only as "Josef K." In fact, as I recall, several characters even actually refer to him as Josef K. Why isn't he given a last name? Is this symbolic of the soul-crushing influence of the bureaucracy that is, in some sense, stripping him of his identity?
This answer is primarily based on Ignace Feuerlicht, "Omissions and Contradictions in Kafka's Trial", The German Quarterly 1967, 40(3), pp. 339-350 - available here if you have Jstor access. All quotes below are from this article.
Josef K.'s last name is not the only, though perhaps it is the most prominent, piece of information which is carefully not stated in The Trial. The setting of the novel is also omitted, as are the names of several other characters, and of course the nature of Josef K.'s crime. So it could be said that secretiveness and omission are themes in The Trial as a whole.
Focusing now on the main question, there are a few possible interpretations. (Quotes below are all from the Feuerlicht article.)
Symbolising his emptiness and lifelessness.
This theory seems convincing at first glance, but it doesn't hold much water when we compare Josef K. to other characters in the book with or without their surnames specified:
The lack of his last name can be taken and has been taken as a sign and accusation of his emptiness, lifelessness, or of the anonymity and fragmentation of modern life, especially that of the middle class. But Rabensteiner or Miss Montag, for instance, are not more alive or greater individ- ualists than K., in spite of their full last names. Another "accused" man is actually the only one in the novel to have a first and a last name (Rudolf Block). K.'s antagonist, the assistant director, has no name at all; nor are the names of the director, the priest, or any high Court official, or the Court itself mentioned.
Indicating Kafka's contempt for him.
There is some evidence for this theory in the words of Kafka himself:
In a diary entry of a day when he might have been working on the Trial (27 May, 1914), Kafka writes that he finds the "K" ugly, almost nauseating. "And yet I write it down, it must be characteristic of me" (T, 375).1 To be sure, the passage refers only to the letter "K" as written by Kafka, and not to any symbolic or philosophic meaning which it might have for Kafka or for his novel.
Denoting Franz Kafka himself.
In German, the letter K is called "ka", so Kafka sounds almost like K-fK. And the final letter of "Josef" gives us the F, so "Josef K." almost rhymes with "Kafka".
K., to be sure, is in some respects akin to Kafka. He is employed by a large firm, is single, and has a decisive experience at the age of thirty (Kafka had a literary breakthrough when he wrote "Das Urteil" at about that age). But he is in many ways Kafka's opposite. Unlike Kafka, he does not suffer from a "father complex" or from an "infinite" guilt (H, 196), but is full of self-confidence. He does not seem to possess any creative abilities. He is a self-made man and quite satisfied with his job. While K. probably is of average height (he is shorter than Willem and taller than Block), Kafka was six foot tall. Unlike K., Kafka frequently suffered from insomnia and headaches, often was late for appointments, did not wear heavy clothing in winter, and did not drink any liquor.
Denoting Franz Kafka'a father Herrmann.
Perhaps this other Kafka would be a better analogy for the role - the surname connection doesn't necessarily imply a representation of the author himself.
[L]ike K., Kafka's father was a self-made man, had an oratorical flair, looked down on people below his social rank, was of robust health, had frequent fits of anger, and was superficially religious. He, too, had an experience at the age of thirty that started a new chapter in his life: He opened a store in Prague. And, for the benefit of those who believe that "the man from the country" in the Türhüterlegende corresponds to K., Kafka's father was literally a man from the country. But in spite of the similarities and in spite of the initial "K," Josef K. is neither a dehydrated Franz Kafka nor an emasculated Herrmann Kafka, but a literary figure in his own rights and with his own life.
So there you go. Four different theories for why Josef K.'s last name was never revealed, each with reasons both for and against believing it. Take your pick.
1 Cited to Franz Kafka, Der Prozeß (Berlin, 1951). H stands for Hochzeitsvorbereitungen auf dem Lande (New York, 1953) and T for Tagebucher (New York, 1948).