What you call a "pencil" - a pattern in the way certain subatomic particles are arranged, exhibiting certain properties in interactions with other things - continues to exist even inside the box. The conditions for observing some of those interactions continues to exist (e.g. you can measure mass, and interaction with other electromagnetic frequencies to which the box is not as opaque) even if you have temporarily removed your capability for observing other of those interactions. At any time, whether in the box or not, you can only observe some of the interactions associated with the pattern-label "pencil," due to our limitations as observers. By putting the pencil in the box, you are slightly modifying the set of interactions you can easily observe.
Also keep in mind that interactions with visual wavelengths are not the only interactions we use to define "pencil;" for example there are some objects which look and/or feel like pencils but don't write like pencils (e.g. they might write like pens or not write), which many ontologists would likely say is a defining characteristic, though it depends on the purpose for which the label is being applied.
By contrast, let us consider what happens when I put a small piece of dry ice in the same box, and let that box sit for some time at "normal" room temperature and pressure. In that case, the dry ice does actually cease to exist. This is because what we call "dry ice" necessarily refers to the solid form of carbon dioxide, an arrangement of particles that has certain properties in interactions with other things. When the carbon dioxide has all sublimated to the gaseous form, it no longer exhibits those properties.
If the dry ice box were airtight, one could still observe (with a very sensitive scale) that the mass of the box + dry ice was equal to the mass of the "empty" box plus the mass of the dry ice, and if the right equipment were available one could theoretically recapture all the carbon dioxide, and re-form the dry ice. If the box were not airtight and left alone long enough, even the mass difference would no longer be observed because the extra carbon dioxide would escape, and relative fractions of different gases would equalize with the surrounding atmosphere.
However, if the dry ice box (airtight or not) also contained a plant, even [at least some of] the carbon dioxide molecules would no longer "exist" but would have been disassembled and reassembled into patterns that we might call "oxygen" and "cell wall" based on their properties in interactions with other things.