germany
One typical reason why somebody may not disclose self-exonerating evidence is that they accept punishment for somebody else.
The motive could be to protect a family member; or it may be a transaction like a mobster shielding his boss in exchange for some benefit.
Preventing punishment of a perpetrator is a criminal act though, per §259 of the criminal code:
Wer absichtlich oder wissentlich ganz oder zum Teil vereitelt, daß ein anderer dem Strafgesetz gemäß wegen einer rechtswidrigen Tat bestraft [...] wird, wird mit Freiheitsstrafe bis zu fünf Jahren oder mit Geldstrafe bestraft.
Sentence 6 of that paragraph exempts protecting family members though, following the general German principle that the protection from self-incrimination extends to family members.
united-states
In Massachusetts it is a crime to mislead a criminal investigation per General Laws Chapter 268 Section 13B:
Whoever willfully [...] misleads [...] another person who is a [...] investigator [...] with the intent to [...] impede, obstruct, delay, prevent or otherwise interfere with [...] a criminal investigation at any stage shall be punished [by fine or imprisonment].
Withholding evidence that shows that oneself has not committed a crime can probably be interpreted as obstructing the investigation of the crime, especially considering the scenarios in the "germany" section above. (That said, I'd be curious whether anybody has ever been sentenced for that.)