The Laws of Cricket say that you can declare any innings, no matter what the agreed length is.
ODIs and Twenty20 Internationals, however, are playing under the ICC Playing Conditions, which modify the Laws of Cricket. Both the ODI and the T20I playing conditions say "Law 14 shall not apply." (Law 14 is Declaration and Forfeiture.) The analogous domestic limited-overs competitions are usually playing under very similar rules.
So no, in practice, you cannot declare in a limited-overs game.
If you really wanted to stop batting, all the batsmen could retire or time out, but that would go down differently in their personal statistics.