CAVEAT: For those who are offended by the inclusion of humor into an answer, be forewarned that there will be an instance of humor in the paragraph coming after the words highlighted in yellow, "Is not this the carpenter's son . . .."
As Davïd indicates above, there is more than a little speculation as to when, or even if, Joseph died at some point after the "child-left-behind" incident recorded in Luke chapter 2.
Those arguing for a death at some point prior to the beginning of Jesus' public ministry, cite the following verses as "proof"; the fifth reference is used to argue Joseph may have been alive, at least at some point during his stepson's public ministry.
Those arguing for Joseph being alive during Jesus' public ministry might cite John 5:41 and 42:
"Therefore the Jews were grumbling about [Jesus], because He said 'I am the bread of life that came down out of heaven. They were saying, 'Is not this Jesus, the son of Joseph, whose father and mother we know? How does He now say, 'I have come down out of heaven?'"
You can read the first four verses, above (in context, of course!), at your leisure. The first three verses are parallel one to the other, and reading them side by side at a website such as biblestudytools can be both enlightening and enjoyable. The incident these verses have in common occurred in Capernaum of Galilee, where Jesus' teaching drew a crowd, which included His mother and half-brothers who, for whatever reasons, came to see Him.
While the chronology of the incident, particularly what came before it, is a bit murky, the reason Jesus' family ("His own people," Mark 3:21) came to see Him could likely have been to protect Him by taking Him into their custody (ibid). Clearly (well, they thought they were thinking clearly!), they thought He was out-of-His-mind bonkers.
The point is: Jesus' mother--not His stepfather and mother, His stepbrothers (viz., James; Joseph, Jr.; Simon; and Judas) and His stepsisters (not named in Matthew 13:55) are mentioned in the synoptics, but not Joseph, Sr. Could Joseph, Sr., have been dead at this time? Perhaps he was alive and well and simply could not leave his work to come to see Jesus. Perhaps he entrusted Mary his wife to his sons and daughters, confident they would take care of her.
Moreover, from the astonished reaction of His fellow Capernaumites to Jesus' wise teaching and miraculous powers in Matthew 13:55-58,
"Is not this the carpenter's son? Is not His mother called Mary . . .,"
we cannot necessarily conclude that Joseph was dead at this point. Is there significance in the Capernaumites not mentioning Joseph by name in referring to Jesus as "the carpenter's son"? Perhaps, but then perhaps not. Again, Joseph may have been away on business, or at the local Home Depot picking up materials for his next job!
If, however, Joseph was an "older" man at the time he was engaged to Mary (prior to Jesus' birth), he could have been in his sixties or seventies by the time Jesus entered His public ministry. At the time, a man of that age would be considered really "old," so speculating that he was either dead or perhaps even retired or infirm may be justified.
As for the reference to John 2:12, this is where the Apostle John wrote (on the heels of Jesus' first miracle at Cana of Galilee, a small town about 15 or so miles from Capernaum) the following:
"After this He went down to Capernaum, He and His mother and His brothers and His disciples; and they stayed there a few days."
Is there significance (vis a vis your question) that John did not mention Joseph in this verse? Perhaps. Again, however, the reason Joseph is not mentioned could be because he simply wasn't there at the time due to a previous engagement (or sickness, or lack of interest--not likely, or death).
As for Mary and not "Joseph and Mary" being at the crucifixion of her Son, the suggestion that Joseph was dead at the time may or may not be warranted, for the same reasons mentioned above.
My own belief is that Joseph did indeed die sometime between Jesus' twelfth birthday and His bursting on the scene, so to speak, at about age 30, though the fifth verse above (John 6:42) seems to indicate Joseph may have in fact been alive at the time of Jesus' "I am the bread of life" sermon:
"They were saying, 'Is not this Jesus, the son of Joseph, whose father and mother we know? How does He now say, 'I have come down out of heaven?'"
Is our inability to answer definitively this question about Joseph, Jesus' stepfather, a cause for alarm? I think not. Had God wanted us to have a definitive answer, He would have included it in His word. (Take for example Jesus' post-resurrection Bible study with Cleopas and the other disciple on Emmaus Road, in Luke 24. I would love to know what Jesus talked about there, but again, the Holy Spirit did not see fit to include that particular tutorial in the canon of Scripture.)